public ShootFireballState(GameObject npc, int maxShots, float timeBetweenShots)
 {
     stateID               = StateID.ShootingFireballs;
     npcAttack             = npc.GetComponent <NPCAttack>();
     this.maxShots         = maxShots;
     this.timeBetweenShots = timeBetweenShots;
 }
Ejemplo n.º 2
0
 // 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();
 }
Ejemplo n.º 3
0
    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;
    }
Ejemplo n.º 4
0
    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);
        }
    }
Ejemplo n.º 5
0
 private void Awake()
 {
     _player    = GameObject.FindGameObjectWithTag("Player");
     _npcAttack = transform.GetComponentInParent <NPCAttack>();
 }