private void StraightLaunch() { agent.isStopped = true; if (timeSinceLastAttack_insideRange > attackDelay_inRange) { //launch projectile when the internal timer is more than the attack delay: projectileLauncher.LaunchProjectile(projectilePrefab, DirectionToPlayer(), straightLaunchSpeed, launchLocation.position); timeSinceLastAttack_insideRange = 0f; } else { timeSinceLastAttack_insideRange += Time.deltaTime; } timeSinceLastAttack_outsideRange += Time.deltaTime; }
private void Action(Protocol.BaseProtocol proto) { Protocol.GameAction gameAct = proto.AsType <Protocol.GameAction>(); if (gameAct.player_id != playerId) { return; } switch (gameAct.Action) { case Protocol.GameAction.Actions.DropItem: itemHold.DropItem(); break; case Protocol.GameAction.Actions.LaunchProjectile: projectileLauncher.LaunchProjectile(); break; } }