Exemple #1
0
        public virtual void StartAbility(Player player)
        {
            AbilityHandler handler = player.GetModPlayer <AbilityHandler>();
            DragonHandler  dragon  = player.GetModPlayer <DragonHandler>();

            //if the player: has enough stamina  && unlocked && not on CD     && Has no other abilities active
            if (CanUse && handler.StatStamina >= StaminaCost && !Locked && Cooldown == 0 && !handler.Abilities.Any(a => a.Active))
            {
                handler.StatStamina -= StaminaCost; //Consume the stamina
                                                    //if (dragon.DragonMounted) OnCastDragon(); //Do what the ability should do when it starts
                                                    /*else*/
                OnCast();
                Active = true;                      //Ability is activated

                if (Main.netMode == NetmodeID.MultiplayerClient)
                {
                    SendPacket();
                }
            }
        }
        public virtual void StartAbility(Player player)
        {
            AbilityHandler handler = player.GetModPlayer <AbilityHandler>();
            DragonHandler  dragon  = player.GetModPlayer <DragonHandler>();

            //if the player: has enough stamina  && unlocked && not on CD     && Has no other abilities active
            if (CanUse && handler.StatStamina >= StaminaCost && !Locked && Cooldown == 0 && !handler.Abilities.Any(a => a.Active))
            {
                handler.StatStamina -= StaminaCost; //Consume the stamina
                if (dragon.DragonMounted)
                {
                    OnCastDragon();                       //Do what the ability should do when it starts
                }
                else
                {
                    OnCast();
                }
                Active = true; //Ability is activated
            }
        }
Exemple #3
0
    void CmdSpawnAvatar()
    {
        Debug.Log("Server received command: Spawn Avatar -- ID: " + PlayerID);

        DragonSpawnPoint[] spawnPoints = GameObject.FindObjectsOfType <DragonSpawnPoint>();

        Transform spawnPointToUse = null;

        foreach (DragonSpawnPoint spawn in spawnPoints)
        {
            if (spawn.SpawnPointID == PlayerID)
            {
                spawnPointToUse = spawn.transform;
            }
        }

        DragonHandler avatarInstance = Instantiate(Avatar, spawnPointToUse.position, Quaternion.identity) as DragonHandler;

        NetworkServer.SpawnWithClientAuthority(avatarInstance.gameObject, connectionToClient);

        RpcSetAvatar(avatarInstance.gameObject);
    }
Exemple #4
0
 void RpcSetAvatar(GameObject avatar)
 {
     Debug.Log("Client received RPC: Spawn Avatar");
     spawnedAvatar = avatar.GetComponent <DragonHandler>();
 }