public ShootFireballState(GameObject npc, int maxShots, float timeBetweenShots) { stateID = StateID.ShootingFireballs; npcAttack = npc.GetComponent <NPCAttack>(); this.maxShots = maxShots; this.timeBetweenShots = timeBetweenShots; }
// Use this for initialization void Start() { animator = GetComponent <Animator>(); npcMovement = GetComponent <NPCMovement>(); npcAttack = GetComponent <NPCAttack>(); npcVision = GetComponent <NPCVision>(); HitColliders = GetComponentsInChildren <DamageZone>(); PlayerController = FindObjectOfType <PlayerController>(); ActivateHitColliders(); }
private void OnEnable() { animator = GetComponent <Animator>(); npcMovement = GetComponent <NPCMovement>(); npcAttack = GetComponent <NPCAttack>(); npcVision = GetComponent <NPCVision>(); NPCMovement.ActivateNavAgent(); npcVision.enabled = true; HitColliders = GetComponentsInChildren <DamageZone>(); PlayerController = FindObjectOfType <PlayerController>(); ActivateHitColliders(); Dead = false; }
private void OnTriggerEnter(Collider other) { if (other.name.Equals("Sphere")) { int otherPlayerId = other.GetComponentInParent <Player>().id; if (otherPlayerId != id) { bool isOnShip = GameServer.clients[otherPlayerId].player.data.is_on_ship; /*if (isOnShip) * { * ServerSend.DestroyPlayerCharacter(id, otherPlayerId); * }*/ ServerSend.ActivateShip(id, otherPlayerId); ServerSend.Stats(otherPlayerId, id); ServerSend.Buffs(otherPlayerId, id); } } else if (other.name.Equals("PlayerSphere")) { int otherPlayerId = other.GetComponentInParent <PlayerCharacter>().id; if (otherPlayerId != id) { ServerSend.ActivatePlayerCharacter(id, otherPlayerId); ServerSend.Stats(otherPlayerId, id); ServerSend.Buffs(otherPlayerId, id); Player player = GameServer.clients[otherPlayerId].player; if (player.playerMovement.agent.enabled) { ServerSend.DeactivatePlayerMovement(otherPlayerId, player.playerInstance.transform.position); } else { ServerSend.ActivatePlayerMovement(otherPlayerId, player.playerInstance.transform.position); } } } else if (other.tag.Equals("Resource")) { gatheringEnabled = true; currentResource = other.gameObject; } else if (other.tag.Equals("Dock")) { dock = other.gameObject; isOnDock = true; } else if (other.tag.Equals("CraftingSpot")) { craftingEnabled = true; craftingSpot = other.GetComponent <CraftingSpot>(); } else if (other.tag == "Trader") { tradingEnabled = true; trader = other.gameObject.GetComponent <Trader>(); } else if (other.tag == "TradeBroker") { tradeBrokerEnabled = true; } else if (other.tag == "Weapon") { PlayerAttack.OnPlayerAttack(this, other); } else if (other.name.Equals("NPCSphere")) { int npcId = other.GetComponentInParent <NPC>().id; ServerSend.NPCStats(npcId, id); ServerSend.ActivateNPC(id, npcId); } else if (other.name.Equals("DamageCollider")) { NPC npc = other.GetComponentInParent <NPC>(); DamageColliderInfo info = other.GetComponent <DamageColliderInfo>(); NPCAttack.OnNPCAttack(info, npc, this); } }
private void Awake() { _player = GameObject.FindGameObjectWithTag("Player"); _npcAttack = transform.GetComponentInParent <NPCAttack>(); }