public override bool AttackInDirection(Vector2 direction, bool regenMana = false) { if (timeToAttack <= 0 && (am == null || am.globalCDProgress >= am.globalCooldown)) { if (animator) { animator.WeaponStrike(); } // kreiranje projektila na mestu nosioca GameObject projectile = Instantiate(firePrefab); projectile.transform.position = transform.position; Transform target = autolock.GetClosest(); PlayerWithJoystick player = parent.GetComponent <PlayerWithJoystick>(); int bonusDamage = (player ? player.GetDamage() : 0); // ispaljivanje projektila if (target) { projectile.GetComponent <FireProjectile>().Shoot(parent.transform, target, damage + bonusDamage, range, projectileSpeed, knockback, knockbackForce, regenMana); } else { projectile.GetComponent <FireProjectile>().Shoot(parent.transform, direction, damage + bonusDamage, range, projectileSpeed, knockback, knockbackForce, regenMana); } base.AttackInDirection(direction); return(true); } return(false); }
private void OnTriggerEnter2D(Collider2D collision) { PlayerWithJoystick player = collision.GetComponent <PlayerWithJoystick>(); if (player != null) { player.AddRotation(right ? angle : -angle); } }
protected virtual void OnTriggerExit2D(Collider2D collision) { PlayerWithJoystick player = collision.GetComponent <PlayerWithJoystick>(); if (player && (interactable || canReactivate)) { player.ActionChange(PlayerWithJoystick.ActionChangeType.SWAP_TO_WEAPON, transform); } }
protected override void updateVector2() { if (GameManager.joystick) { player = GameManager.I.playerInstance as PlayerWithJoystick; vector2 = player.GetFacingDirection(); } else { base.updateVector2(); } }
public void AttackPointerDown(JoystickController joystick) { PlayerWithJoystick player = GameManager.I.playerInstance as PlayerWithJoystick; if (player.action == PlayerWithJoystick.ActionType.WEAPON) { joystick.transform.parent.GetComponent <CanvasGroup>().alpha = 1; GameManager.I.playerInstance.GetWeapon().StartHitting(joystick.InputDirection); } else { player.DoAction(); } }
protected override void OnTriggerEnter2D(Collider2D collision) { base.OnTriggerEnter2D(collision); if (collision.GetComponent <AttackingCharacter>() == GameManager.I.playerInstance) { PlayerWithJoystick player = GameManager.I.playerInstance as PlayerWithJoystick; switch (type) { case PortalType.ENTRY: animator.SetTrigger("Deactivate"); break; } } }
public void UpdateAbilityButtons() { PlayerWithJoystick player = parent as PlayerWithJoystick; int i = 0; foreach (Ability ability in abilities) { if (player.energy < ability.manaCost) { UIManager.I.DisableAbilityButton(i); } else { UIManager.I.EnableAbilityButton(i); } i++; } }
public void SaveGame() { print("Saving progress..."); BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Create(savePath); PlayerWithJoystick player = GameManager.I.playerInstance as PlayerWithJoystick; GameState game = new GameState(); game.isRunStarted = GameManager.I.isRunStarted; game.gameMode = GameManager.I.gameMode; game.gameLevel = GameManager.I.currentLevel; game.coins = GameManager.I.coins; game.attributes = GameManager.I.attributes; game.abilities = GameManager.I.abilities; game.activeQuests = QuestManager.I.GetQuestInfos(); gameState = game; bf.Serialize(file, game); file.Close(); }