https://dumpz.org/#

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NewPlayerScript : NewCharacterScript
{
public CameraScript playerCamera;
private TrackedTouch trackedTouch = new TrackedTouch();
private float killStreakTimeOut = 0f;
private const float killStreakInterval = 7.0f;
private int killStreak = 0;
private float vibroTimeOut = 0;
private float vibroTimeInterval = 2.0f;
private int lostedWeapons = 0;
private float maxCameraOffset = 2.5f;
private float cameraOffsetFactor = 20f;
#if UNITY_EDITOR
private float activationResurrectAbilityTime; // время с начала раунда, когда включается возможность воскрешаться
#else
private float activationResurrectAbilityTime = 10f; // время с начала раунда, когда включается возможность воскрешаться
#endif
private int resurrectQuantity = 1; // количество возможных воскрешений
private ResurrectModel resurrectModel;
// Achivements
private float zeroSwordsTimer = 0f;
private float fiveKillsInOneMinuteTimer = 0f;
private bool fiveKillsInOneMinuteStarted = false;
private int fiveKillsInOneMinuteAchiveKillCounter = 0;
private float fiveKillsInThirtySecondsTimer = 0f;
private bool fiveKillsInThirtySecondsStarted = false;
private int fiveKillsInThirtySecondsAchiveKillCounter = 0;
private bool is140SwordsCollected = false;
private float rotatingFactor = 0f;
// NEW MOVING SYSTEM
private bool hasMoving = false;
private Vector2 currentJoy = new Vector2();
private Vector2 previousPos = new Vector2();
public override void Start()
{
base.Start();
GameObject.Find("Canvas").GetComponent<Canvas>().worldCamera = playerCamera.gameObject.GetComponent<Camera>();
GameObject.Find("Canvas").GetComponent<Canvas>().sortingLayerName = "UI";
List <Loyalty> loyalties = LoyaltyManager.GetAvaiableLoyalties();
loyalties.ForEach((loyalty) =>
{
if (loyalty.enabled)
{
switch (loyalty.type)
{
case LoyaltyType.BonusSpeed:
bonusPercentSpeed += loyalty.loyaltyValue / 100f;
break;
}
}
});
AppendToMaxHealth();
damageModel = new DamageHandler(this);
}
public override void Update()
{
base.Update();
if (isDead || ThinkToResurrect)
return;
var weaponCount = GetWeaponsCount();
var cameraOffset = weaponCount / cameraOffsetFactor;
cameraOffset = cameraOffset > maxCameraOffset ? maxCameraOffset : cameraOffset;
playerCamera.offsetByWeaponCount = cameraOffset;
if (GetWeaponsCount() > 0)
zeroSwordsTimer = 0f;
else
zeroSwordsTimer += Time.deltaTime;
if(zeroSwordsTimer > 60f)
{
QuestsManager.instance.UpdateQuests(QuestType.OneMinuteWithoutKnives, 1);
zeroSwordsTimer = 0f;
}
// 5 kills in 30 seconds
if (fiveKillsInThirtySecondsTimer > 30f)
fiveKillsInThirtySecondsStarted = false;
if (fiveKillsInThirtySecondsStarted)
{
fiveKillsInThirtySecondsTimer += Time.deltaTime;
if (fiveKillsInThirtySecondsAchiveKillCounter >= 5)
{
SharedProperties.IncFiveKillsInThirtySecondsCount();
// Reset
fiveKillsInThirtySecondsStarted = false;
fiveKillsInThirtySecondsTimer = 0;
fiveKillsInThirtySecondsAchiveKillCounter = 0;
}
}
else
{
fiveKillsInThirtySecondsTimer = 0;
fiveKillsInThirtySecondsAchiveKillCounter = 0;
}
// 5 kills in 1 minute
if (fiveKillsInOneMinuteTimer > 60f)
fiveKillsInOneMinuteStarted = false;
if (fiveKillsInOneMinuteStarted)
{
fiveKillsInOneMinuteTimer += Time.deltaTime;
if(fiveKillsInOneMinuteAchiveKillCounter >= 5)
{
SharedProperties.IncFiveKillsInOneMinuteScoreCount();
// Reset
fiveKillsInOneMinuteStarted = false;
fiveKillsInOneMinuteTimer = 0;
fiveKillsInOneMinuteAchiveKillCounter = 0;
}
}
else
{
fiveKillsInOneMinuteTimer = 0;
fiveKillsInOneMinuteAchiveKillCounter = 0;
}
vibroTimeOut -= Time.deltaTime;
// #if UNITY_EDITOR
// targetPosition = transform.position + Vector3.up * Input.GetAxis("Vertical") + Vector3.right * Input.GetAxis("Horizontal");
// if(Input.GetKey(KeyCode.LeftShift))
// {
// bonusPercentSpeed = 2;
// } else
// {
// bonusPercentSpeed = 1;
// }
// #else
if (Input.touchCount > 0 && !gameHandler.IsGameEneded())
{
var touch = Input.GetTouch(0);
switch (touch.phase)
{
case TouchPhase.Began:
trackedTouch.startPos = touch.position;
trackedTouch.currentPos = touch.position;
isForceUndefence = true;
break;
case TouchPhase.Stationary:
case TouchPhase.Moved:
trackedTouch.currentPos = touch.position;
// Vector2 screenJoy = trackedTouch.currentPos - trackedTouch.startPos;
// screenJoy.x = Mathf.Clamp(screenJoy.x / (Screen.width * 0.5f), -1f, 1f);
// screenJoy.y = Mathf.Clamp(screenJoy.y / (Screen.height * 0.5f), -1f, 1f);
//
// targetTranslate = new Vector3(screenJoy.x, screenJoy.y, 0);
//
// targetPosition = new Vector3(transform.position.x + screenJoy.x, transform.position.y + screenJoy.y, 0);
//
// isForceUndefence = true;
// --= new system of movement =--
// Vector2 screenJoy = trackedTouch.currentPos - trackedTouch.startPos;
Vector2 screenJoy = new Vector2();
if (trackedTouch.currentPos != (previousPos != Vector2.zero ? previousPos : trackedTouch.startPos))
{
screenJoy = trackedTouch.currentPos -
(previousPos != Vector2.zero ? previousPos : trackedTouch.startPos);
}
if (hasMoving)
{
if (trackedTouch.currentPos == previousPos)
{
// сохраняем screenJoy
}
else
{
hasMoving = true;
screenJoy.x = Mathf.Clamp(screenJoy.x / (Screen.width * 0.5f), -1f, 1f);
screenJoy.y = Mathf.Clamp(screenJoy.y / (Screen.height * 0.5f), -1f, 1f);
}
}
else
{
if (trackedTouch.currentPos != previousPos && trackedTouch.currentPos != touch.position)
{
hasMoving = true;
screenJoy.x = Mathf.Clamp(screenJoy.x / (Screen.width * 0.5f), -1f, 1f);
screenJoy.y = Mathf.Clamp(screenJoy.y / (Screen.height * 0.5f), -1f, 1f);
}
}
targetTranslate = new Vector3(screenJoy.x, screenJoy.y, 0); // old
targetPosition = new Vector3(transform.position.x + screenJoy.x, transform.position.y + screenJoy.y, 0); // old
isForceUndefence = true; // old
previousPos = previousPos == Vector2.zero ? trackedTouch.startPos : trackedTouch.currentPos; // new
break;
case TouchPhase.Canceled:
case TouchPhase.Ended:
targetPosition = transform.position;
targetTranslate = Vector3.zero;
isForceUndefence = false;
hasMoving = false;
previousPos = Vector2.zero;
break;
}
}
else
{
targetPosition = transform.position;
}
// #endif
if (killStreakTimeOut > 0)
{
killStreakTimeOut -= Time.deltaTime;
}
else
{
killStreak = 0;
}
rotatingFactor = targetTranslate.magnitude / Mathf.Sqrt(2);
spriteHolder.transform.rotation = Quaternion.RotateTowards(spriteHolder.transform.rotation, Quaternion.Euler(0, 0, spriteAngle * rotatingFactor), selfRotatingSpeed * Mathf.Deg2Rad);
}
protected override void OnPauseEnabled(bool value)
{
base.OnPauseEnabled(value);
}
protected override void MoveToTargetPosition(float deltaTime)
{
base.MoveToTargetPosition(deltaTime);
isDefence = false;
if (playerCamera != null)
{
playerCamera.bigSize = 3.5f;
}
}
public override void DropWeapon(NewRazerScript weapon)
{
base.DropWeapon(weapon);
playerCamera.Shake(0.05f, 0.2f);
if (vibroTimeOut < 0)
{
if (SharedProperties.IsVibroOn() && !gameHandler.isNeedToDisableSounds)
{
#if UNITY_EDITOR
#elif UNITY_ANDROID
Vibration.Vibrate(10);
#elif UNITY_IOS
Vibration.VibratePop();
#endif
}
lostedWeapons = 0;
}
else if (lostedWeapons < 3 || lostedWeapons % 3 == 0)
{
if (SharedProperties.IsVibroOn() && !gameHandler.isNeedToDisableSounds)
{
#if UNITY_EDITOR
#elif UNITY_ANDROID
Vibration.Vibrate(10);
#elif UNITY_IOS
Vibration.VibratePop();
#endif
}
}
lostedWeapons += 1;
vibroTimeOut = vibroTimeInterval;
}
public override void AppendVictim(GameObject victim)
{
fiveKillsInOneMinuteStarted = true;
fiveKillsInOneMinuteAchiveKillCounter++;
fiveKillsInThirtySecondsStarted = true;
fiveKillsInThirtySecondsAchiveKillCounter++;
playerCamera.Shake(0.5f, 0.5f);
if (SharedProperties.IsVibroOn() && !gameHandler.isNeedToDisableSounds)
{
#if UNITY_EDITOR
#elif UNITY_ANDROID
Vibration.Vibrate(50);
#elif UNITY_IOS
Vibration.VibratePeek();
#endif
}
if (!victims.Contains(victim))
{
killStreak += 1;
killStreakTimeOut = killStreakInterval;
gameHandler.HandlePlayerKillStreak(killStreak);
if(isDefence)
{
QuestsManager.instance.UpdateQuests(QuestType.KillInDefence, 1);
}
}
base.AppendVictim(victim);
}
protected override void Defence()
{
base.Defence();
isDefence = true;
if (playerCamera != null)
{
playerCamera.bigSize = 0f;
}
}
public void Init()
{
float startTime = Time.time;
resurrectModel = new ResurrectModel(startTime, activationResurrectAbilityTime, resurrectQuantity);
}
protected override void HandleDeath(bool canResurrect)
{
if (ThinkToResurrect) return;
base.HandleDeath(resurrectModel.CanResurrect);
playerCamera.Shake(0.5f, 1f);
if (SharedProperties.IsVibroOn() && !gameHandler.isNeedToDisableSounds)
{
#if UNITY_EDITOR
#elif UNITY_ANDROID
Vibration.Vibrate(100);
#elif UNITY_IOS
Vibration.VibrateNope();
#endif
}
if (resurrectModel.CanResurrect)
{
resurrectModel.Resurrect();
ThinkToResurrect = true;
}
else
{
deathAnimator.Play();
}
}
public override void ZoomInCamera()
{
base.ZoomInCamera();
float scale = transform.localScale.x;
if (scale <= minScale)
{
return;
}
playerCamera.targetSize -= 0.05f;
}
public override void ZoomOutCamera()
{
base.ZoomOutCamera();
float scale = transform.localScale.x;
if (scale >= maxScale)
{
return;
}
playerCamera.targetSize += 0.05f;
}
public void SetUiModel(UnitUIModel model)
{
uiModel = model;
foreach (var weapon in weaponCollection)
{
weapon.SetUnitUIModel(uiModel);
}
}
private class TrackedTouch
{
public Vector2 startPos;
public Vector2 currentPos;
}
public override void AppendWeapon(NewRazerScript objectScript)
{
base.AppendWeapon(objectScript);
QuestsManager.instance.UpdateQuests(QuestType.CollectKnivesTotal, 1);
if(GetWeaponsCount() >= 140 && !is140SwordsCollected)
{
is140SwordsCollected = true;
SharedProperties.IncCollect140SwordsCount();
}
}
protected override void GetHaste(HasteScript hasteObject)
{
float tHasteDuration = hasteObject.hasteDuration + hasteObject.hasteDuration * bonusHasteDuration;
gameHandler.PlayerGotHaste(tHasteDuration);
base.GetHaste(hasteObject);
}
protected override void ApplySpell(SpellModel spell)
{
base.ApplySpell(spell);
if (TutorialManager.chanceStayAlive > 0f)
{
deflectionBonus = TutorialManager.chanceStayAlive / 100f;
}
}
}