protected void Awake()
    {
        pathIndex     = 0;
        pathType      = transform.position.x <= PathFinding.Path[0][0].x ? 0 : 1;
        priority      = new int[2];
        priorityIndex = 0;

        CanAffectTotalNumber = true;

        particle = transform.Find("Particle_EnemyDeath").gameObject;
        particle.SetActive(false);

        if (TargetList == null)
        {
            TargetList = new PlayerBuilding[2][];

            //Second array is tower
            GameObject[] temp = GameObject.FindGameObjectsWithTag("Tower");
            TargetList[0] = new PlayerBuilding[temp.Length];
            for (int i = 0; i < temp.Length; i++)
            {
                TargetList[0][i] = temp[i].GetComponent <Tower>();
            }

            //Third array is Trap
            temp          = GameObject.FindGameObjectsWithTag("Trap");
            TargetList[1] = new PlayerBuilding[temp.Length];
            for (int i = 0; i < temp.Length; i++)
            {
                TargetList[1][i] = temp[i].GetComponent <Trap>();
            }
        }
    }
Beispiel #2
0
            public override void Execute()
            {
                var building = new PlayerBuilding(blueprint, footprint);

                game.Add(building);
                game.Add(new DebugWorker(building.BuildManager));
            }
    private void UpdateTargetBuilding(PlayerBuilding target)
    {
        targetBuilding = target;
        Vector3 temp = targetBuilding.transform.position;

        targetBuildingPos = targetBuilding.transform.position; //new Vector3(temp.x, transform.localScale.y / 2.0f, temp.z);
        currentState      = State.InRange;
    }
 public void UpdateButtons(PlayerBuilding playerBuilding)
 {
     button.gameObject.SetActive(true);
     upgradeButton.gameObject.SetActive(true);
     button.interactable        = true;
     icon.sprite                = playerBuilding.GetImage();
     upgradeButton.interactable = true;
 }
    void Start()
    {
        playerID         = GetComponent <PlayerProperties>().playerID;
        playerObj        = gameObject;
        playerMovement   = GetComponent <PlayerMovement>();
        playerShooting   = GetComponent <PlayerShooting>();
        playerBuilding   = GetComponent <PlayerBuilding>();
        runtimeVariables = RuntimeVariables.GetInstance();
        pauseManager     = GameObject.Find("SceneManager").GetComponent <PauseManager>();

        audioManager.StopFirewallBuildingSound();
        SetupControls();
        SetupComputers();
    }
Beispiel #6
0
    void Start()
    {
        playerID         = 1;
        playerObj        = gameObject;
        playerMovement   = GetComponent <PlayerMovement>();
        playerShooting   = GetComponent <PlayerShooting>();
        playerBuilding   = GetComponent <PlayerBuilding>();
        runtimeVariables = RuntimeVariables.GetInstance();
        pauseManager     = GameObject.Find("SceneManager").GetComponent <PauseManager>();
        //audioManager = GetComponentInChildren<PlayerAudioManager>();

        SetupControls();
        GameObject.Find("Player0").GetComponent <PlayerControl> ().SetNPCref(this);
        timer = mirrorDelay;
    }
    public bool BuildPlayerBuilding(PlayerBuildingConfig playerBuildingConfig, Player player, int buildingNumber)
    {
        if (!playerSpyNetworks.ContainsKey(player))
        {
            return(false);
        }

        if (playerBuildings[player].Count >= maxPlayerBuildings)
        {
            return(false);
        }



        PlayerBuilding playerBuilding = Instantiate(playerBuildingGameObject, transform.Find("PlayerBuildings")).GetComponent <PlayerBuilding>();

        playerBuilding.SetConfig(playerBuildingConfig);
        playerBuilding.SetSystem(GetComponent <SolarSystem>());
        playerBuilding.Build(buildingNumber);
        playerBuildings[player].Add(playerBuilding);

        return(true);
    }
Beispiel #8
0
 void Start()
 {
     PB = GameObject.Find("Player").GetComponent <PlayerBuilding>();
 }
Beispiel #9
0
 void Start()
 {
     Anim = GetComponent <Animation>();
     PB   = GameObject.Find("Player").GetComponent <PlayerBuilding>();
 }