public void Awake()
    {
        // Class SetUps
        canDrop = false;

        SlctdLant = LanternType.Regular;

        // Set key code:
        key = KeyCode.Mouse1;

        // Component Getters
        avatarController = GetComponent<AvatarController>();

        // Initialization
        SlctdLant = LanternType.Regular;
        spawnDistance = 1.0f;
        maxLanternCount = UseCount;

        // ToolTip text
        ToolTip.Description = "Places a Latern down.\nLimited amount.";

        ToolTip.FirstLabel =        "Duration:";
        ToolTip.FirstAttribute =    "8 sec";

        ToolTip.SecondLabel =       "Cooldown:";
        ToolTip.SecondAttribute =   Cooldown.ToString() + " sec";

        ToolTip.ThirdLabel =        "";
        ToolTip.ThirdAttribute =    "";
    }
Beispiel #2
0
 public Lantern(string type, int x, int y, int orientation, int h, string uniqueID) : base(x, y, orientation, h, uniqueID)
 {
     LanternType.TryParse(type, true, out this.type);
 }
 public void CmdSetLantExplorer(Vector3 _position, LanternType _slctdLant, float _duration)
 {
     LanternSpawnManager.Instance.CmdSetLantern(_position, _slctdLant, _duration);
 }
    public void CmdSetLantern(Vector3 position, LanternType _SlctdLantern, float _duration)
    {
        GameObject spawnedLantern;

        switch (_SlctdLantern)
        {
            case LanternType.Regular:

                if (LanternsPrefab[0] != null)
                {
                    spawnedLantern = Instantiate(LanternsPrefab[0], position, Quaternion.identity) as GameObject;
                    spawnedLantern.transform.SetParent(LanternContainer);
                    spawnedLantern.GetComponent<LanternBehavior>().Initialize(_duration);
                    if (isServer)
                    {
                        GridBehavior.Instance.SetAIDirty();
                        GridBehavior.Instance.SetGridDirty();
                    }

                    NetworkServer.Spawn(spawnedLantern);
                }
                else
                {
                    Debug.Log("LanternsPrefab[0] == null. Did you forget to assign a prefab?");
                }
                break;

            case LanternType.Red:

                if (LanternsPrefab[1] != null)
                {
                    /*
                    spawnedLantern = Instantiate(LanternsPrefab[0], position, Quaternion.identity) as GameObject;
                    spawnedLantern.transform.SetParent(LanternContainer);
                    NetworkServer.Spawn(spawnedLantern);
                    */
                }
                else
                {
                    Debug.Log("LanternsPrefab[1] == null. Did you forget to assign a prefab?");
                }
                break;

            case LanternType.Blue:

                if (LanternsPrefab[2] != null)
                {
                    /*
                    spawnedLantern = Instantiate(LanternsPrefab[0], position, Quaternion.identity) as GameObject;
                    spawnedLantern.transform.SetParent(LanternContainer);
                    NetworkServer.Spawn(spawnedLantern);
                    */
                }
                else
                {
                    Debug.Log("LanternsPrefab[] == null. Did you forget to assign a prefab?");
                }
                break;

            case LanternType.Orange:
                Debug.Log("Orange Lantern not implemented yet");
                if (LanternsPrefab[3] != null)
                {
                    /*
                    spawnedTrap = Instantiate(TrapsPrefab[2], position, Quaternion.identity) as GameObject;
                    spawnedTrap.transform.SetParent(TrapContainer);
                    NetworkServer.Spawn(spawnedTrap);
                    */
                }
                else
                {
                    Debug.Log("LanternsPrefab[3] == null. Did you forget to assign a prefab?");
                }
                break;

            default:
                Debug.Log("Lantern Type not found.");
                break;
        }
    }