コード例 #1
0
    // Use this for initialization
    void Start()
    {
        myStats = GetComponent <UnitStats>();

        animator                  = GetComponent <Animator>();
        minerAtNode               = GetComponent <MoveToNode>();
        playerBattleManager       = GameObject.Find("PlayerBattleManager");
        enemyBattleManager        = GameObject.Find("EnemyBattleManager");
        playerBattleManagerScript = playerBattleManager.GetComponent <PlayerBattleManager>();
        enemyBattleManagerScript  = enemyBattleManager.GetComponent <EnemyBattleManager>();
        // check if I am an enemy or player miner and add me to their list
        if (gameObject.tag == "PlayerMiner")
        {
            playerBattleManagerScript.myPlayerMiners.Add(gameObject);
            playerBattleManagerScript.mySpawnedUnits.Add(gameObject);

            // Add player upgrades here
            playerMiningGain             = (20 + MinersStatsUpgradesStatic.pokoMinerResourceMiningGainUpgrade);
            myStats.unitCurrentMoveSpeed = (myStats.unitMoveSpeed + MinersStatsUpgradesStatic.pokoMinerMoveSpeedUpgrade);
            myStats.health += MinersStatsUpgradesStatic.pokoMinerHealthUpgrade;
            miningGain      = playerMiningGain + 200;
        }
        else
        {
            enemyBattleManagerScript.myEnemyMiners.Add(gameObject);
            enemyBattleManagerScript.mySpawnedUnits.Add(gameObject);
            // need to add enemy miner adjustments here based on the AIs personal upgrades
        }
    }
コード例 #2
0
    // Use this for initialization
    void Start()
    {
        turretSelectedSpawnSprite = GetComponent <SpriteRenderer>();
        animator                  = GetComponent <Animator>();
        playerBattleManager       = GameObject.Find("PlayerBattleManager");
        enemyBattleManager        = GameObject.Find("EnemyBattleManager");
        myTargeting               = GetComponent <BasicTargeting>();
        myStats                   = GetComponent <UnitStats>();
        turretBaseSprite          = turretBase.GetComponent <SpriteRenderer>();
        turretHeadSprite          = turretHead.GetComponent <SpriteRenderer>();
        playerBattleManagerScript = playerBattleManager.GetComponent <PlayerBattleManager>();
        enemyBattleManagerScript  = enemyBattleManager.GetComponent <EnemyBattleManager>();

        if (gameObject.tag == "PlayerUnit")
        {
            turretBaseSprite.sprite = playerTurretBase;
            turretHeadSprite.sprite = playerTurretHead;
            playerBattleManagerScript.mySpawnedUnits.Add(gameObject);
        }
        else
        {
            turretBaseSprite.sprite = enemyTurretBase;
            turretHeadSprite.sprite = enemyTurretHead;
            enemyBattleManagerScript.mySpawnedUnits.Add(gameObject);
        }

        originalRotation = turretHead.transform.rotation;
    }
コード例 #3
0
    // Use this for initialization
    void Start()
    {
        playerBattleManager       = GameObject.Find("PlayerBattleManager");
        enemyBattleManager        = GameObject.Find("EnemyBattleManager");
        playerBattleManagerScript = playerBattleManager.GetComponent <PlayerBattleManager>();
        enemyBattleManagerScript  = enemyBattleManager.GetComponent <EnemyBattleManager>();
        myStats        = gameObject.GetComponent <UnitStats>();
        moveController = gameObject.GetComponent <BasicMovementController>();
        targetsList    = new List <GameObject>();

        if (myStats.unitName == "Turret")
        {
            turret = GetComponent <Turret>();
        }

        if (myStats.unitName != "Turret")
        {
            if (gameObject.tag == "PlayerUnit")
            {
                enemyGenerator = GameObject.Find("EnemyGenerator");
                targetsList.Add(enemyGenerator);
            }
            else
            {
                enemyGenerator = GameObject.Find("PlayerGenerator");
                targetsList.Add(enemyGenerator);
            }
        }
    }
コード例 #4
0
 // Use this for initialization
 void Start()
 {
     playerBattleManager       = GameObject.Find("PlayerBattleManager");
     playerBattleManagerScript = playerBattleManager.GetComponent <PlayerBattleManager>();
     myStats            = GetComponent <UnitStats>();
     myAnimator         = gameObject.GetComponent <Animator>();
     spawnPodMainSprite = GetComponent <SpriteRenderer>();
 }
コード例 #5
0
    private void Awake()
    {
        gameStateManager    = GetComponentInChildren <GameStateManager>();
        loadStageManager    = GetComponentInChildren <LoadStageManager>();
        playerBattleManager = GetComponentInChildren <PlayerBattleManager>();
        objectPoolManager   = GetComponentInChildren <ObjectPoolManager>();

        DontDestroyOnLoad(this.gameObject);
    }
コード例 #6
0
    protected override void OnEnterWorld()
    {
        GameWorld.thePlayer = this;
        battleManager       = new PlayerBattleManager(this, skillManager);
        skillManager.AddSkill(3);
        skillManager.AddSkill(4);

        Mogo.Util.EventDispatcher.AddEventListener(GUIEvent.STOP_JOYSTICK_TURN, OnStopJoystickTurn);
        Mogo.Util.EventDispatcher.AddEventListener(GUIEvent.START_JOYSTICK_TURN, OnStartJoystickTurn);
    }
コード例 #7
0
 private void Awake()
 {
     battleUIManager           = battleUI.GetComponent <BattleUIManager>();
     playerBattleManagerScript = playerBattleManager.GetComponent <PlayerBattleManager>();
     enemyBattleManagerScript  = enemyBattleManager.GetComponent <EnemyBattleManager>();
     PlacePlayerSpawnPods();
     PlaceEnemySpawnPods();
     PlacePlayerStartingMiners();
     PlaceEnemyStartingMiners();
 }
コード例 #8
0
    // Use this for initialization
    void Start()
    {
        myStats                   = myUnit.GetComponent <UnitStats>();
        myButton                  = gameObject.GetComponent <Button>();
        playerBattleManager       = GameObject.Find("PlayerBattleManager");
        playerBattleManagerScript = playerBattleManager.GetComponent <PlayerBattleManager>();

        // need to set all of my variables based on any upgrades the unit might have
        myUnitCost  = (myStats.unitCost - SpawnerStatsUpgradesStatic.spawnPodCostUpgrade);
        myBuildTime = (myStats.unitBuildTime - SpawnerStatsUpgradesStatic.spawnPodBuildTimeUpgrade);

        myCostText.text = myUnitCost.ToString();
    }
コード例 #9
0
    // Use this for initialization
    void Start()
    {
        myStats                   = myUnitCard.GetComponent <UnitStats>();
        myButton                  = gameObject.GetComponent <Button>();
        playerBattleManager       = GameObject.Find("PlayerBattleManager");
        playerBattleManagerScript = playerBattleManager.GetComponent <PlayerBattleManager>();

        // need to set all of my variables based on any upgrades the unit might have
        myUnitCost  = myStats.unitCost;
        myBuildTime = myStats.unitBuildTime;

        InstantiateMyUnit();

        myCostText.text = myUnitCost.ToString();
    }
コード例 #10
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

        else if (instance != this)
        {
            Destroy(gameObject);
        }

        for (int i = 0; i < players.Length; i++)
        {
            GameObject temp = Instantiate(players[i], createPos[i].transform.position, createPos[i].transform.rotation);
            onStagePlayers.Add(temp);
        }
    }
コード例 #11
0
    // Use this for initialization
    void Start()
    {
        myDefendPosition          = GetDefendPosition();
        myStats                   = gameObject.GetComponent <UnitStats>();
        playerBattleManagerScript = GameObject.Find("PlayerBattleManager").GetComponent <PlayerBattleManager>();
        enemyBattleManagerScript  = GameObject.Find("EnemyBattleManager").GetComponent <EnemyBattleManager>();
        animationIsWalking        = true;

        // set the power generators based on my units perspective
        if (gameObject.tag == "PlayerUnit")
        {
            myGenerator    = GameObject.Find("PlayerGenerator");
            enemyGenerator = GameObject.Find("EnemyGenerator");
        }
        else
        {
            myGenerator    = GameObject.Find("EnemyGenerator");
            enemyGenerator = GameObject.Find("PlayerGenerator");
        }
    }
コード例 #12
0
    // Use this for initialization
    void Start()
    {
        moveController = gameObject.GetComponent <BasicMovementController>();
        animator       = gameObject.GetComponent <Animator>();

        playerBattleManager       = GameObject.Find("PlayerBattleManager");
        enemyBattleManager        = GameObject.Find("EnemyBattleManager");
        playerBattleManagerScript = playerBattleManager.GetComponent <PlayerBattleManager>();
        enemyBattleManagerScript  = enemyBattleManager.GetComponent <EnemyBattleManager>();
        myTargeting = gameObject.GetComponent <BasicTargeting>();
        myStats     = gameObject.GetComponent <UnitStats>();
        myStats.unitCurrentMoveSpeed = myStats.unitMoveSpeed;

        if (gameObject.tag == "PlayerUnit")
        {
            playerBattleManagerScript.mySpawnedUnits.Add(gameObject);
        }
        else
        {
            enemyBattleManagerScript.mySpawnedUnits.Add(gameObject);
        }
    }
コード例 #13
0
    // Use this for initialization
    void Start()
    {
        mySpawningTurret       = null;
        turretIsSlectedToSpawn = false;
        myStats                   = myUnit.GetComponent <UnitStats>();
        myButton                  = gameObject.GetComponent <Button>();
        playerBattleManager       = GameObject.Find("PlayerBattleManager");
        playerBattleManagerScript = playerBattleManager.GetComponent <PlayerBattleManager>();

        // need to set all of my variables based on any upgrades the unit might have
        myUnitCost      = myStats.unitCost;
        myCooldownTimer = (myStats.unitBuildTime - ShipStatsUpgradesStatic.turretCooldownReduction);

        myCostText.text = (myUnitCost - ShipStatsUpgradesStatic.turretResourceDiscount).ToString();


        // button starts on cooldown
        isOnCooldown             = true;
        startBuilTime            = 0;
        cooldownImage.fillAmount = 1;
        myButton.interactable    = false;
    }
コード例 #14
0
 // Use this for initialization
 void Start()
 {
     playerBattleManagerScript = playerBattleManager.GetComponent <PlayerBattleManager>();
 }
コード例 #15
0
    private void BuildResourceMeter(string name)
    {
        playerBattleManagerScript = playerBattleManager.GetComponent <PlayerBattleManager>();
        int resource;

        if (name == "Gold")
        {
            resource = 0;
            for (int i = 0; i < resourceMeterLocations.Count; i++)
            {
                GameObject newResourceMeter = Instantiate(resourceMeter, resourceMeterLocations[i].transform.position, Quaternion.identity);
                newResourceMeter.transform.SetParent(mainUIBackground.transform);
                newResourceMeter.transform.localScale = new Vector3(1, 1, 1);
                ResourceMeter myResourceMeter = newResourceMeter.GetComponent <ResourceMeter>();
                myResourceMeter.sliderFillSprite.sprite = myResourceMeter.resourceFill[resource];
                myResourceMeter.resourceFrontSprite.GetComponent <Image>().sprite = myResourceMeter.resourceFront[resource];
                myResourceMeter.resourceAmount.text = playerBattleManagerScript.playerResourcesAmount[resource].ToString();
                myResourceMeter.resourceType        = "Gold";
                spawnedResourceMeters.Add(myResourceMeter);
                resourceMeterLocations.RemoveAt(i);
                break;
            }
        }
        else if (name == "Iron")
        {
            resource = 1;
            for (int i = 0; i < resourceMeterLocations.Count; i++)
            {
                GameObject newResourceMeter = Instantiate(resourceMeter, resourceMeterLocations[i].transform.position, Quaternion.identity);
                newResourceMeter.transform.SetParent(mainUIBackground.transform);
                newResourceMeter.transform.localScale = new Vector3(1, 1, 1);
                ResourceMeter myResourceMeter = newResourceMeter.GetComponent <ResourceMeter>();
                myResourceMeter.sliderFillSprite.sprite = myResourceMeter.resourceFill[resource];
                myResourceMeter.resourceFrontSprite.GetComponent <Image>().sprite = myResourceMeter.resourceFront[resource];
                myResourceMeter.resourceAmount.text = playerBattleManagerScript.playerResourcesAmount[resource].ToString();
                myResourceMeter.resourceType        = "Iron";
                spawnedResourceMeters.Add(myResourceMeter);
                resourceMeterLocations.RemoveAt(i);
                break;
            }
        }
        else if (name == "Copper")
        {
            resource = 2;
            for (int i = 0; i < resourceMeterLocations.Count; i++)
            {
                GameObject newResourceMeter = Instantiate(resourceMeter, resourceMeterLocations[i].transform.position, Quaternion.identity);
                newResourceMeter.transform.SetParent(mainUIBackground.transform);
                newResourceMeter.transform.localScale = new Vector3(1, 1, 1);
                ResourceMeter myResourceMeter = newResourceMeter.GetComponent <ResourceMeter>();
                myResourceMeter.sliderFillSprite.sprite = myResourceMeter.resourceFill[resource];
                myResourceMeter.resourceFrontSprite.GetComponent <Image>().sprite = myResourceMeter.resourceFront[resource];
                myResourceMeter.resourceAmount.text = playerBattleManagerScript.playerResourcesAmount[resource].ToString();
                myResourceMeter.resourceType        = "Copper";
                spawnedResourceMeters.Add(myResourceMeter);
                resourceMeterLocations.RemoveAt(i);
                break;
            }
        }
        else if (name == "Nickel")
        {
            resource = 3;
            for (int i = 0; i < resourceMeterLocations.Count; i++)
            {
                GameObject newResourceMeter = Instantiate(resourceMeter, resourceMeterLocations[i].transform.position, Quaternion.identity);
                newResourceMeter.transform.SetParent(mainUIBackground.transform);
                newResourceMeter.transform.localScale = new Vector3(1, 1, 1);
                ResourceMeter myResourceMeter = newResourceMeter.GetComponent <ResourceMeter>();
                myResourceMeter.sliderFillSprite.sprite = myResourceMeter.resourceFill[resource];
                myResourceMeter.resourceFrontSprite.GetComponent <Image>().sprite = myResourceMeter.resourceFront[resource];
                myResourceMeter.resourceAmount.text = playerBattleManagerScript.playerResourcesAmount[resource].ToString();
                myResourceMeter.resourceType        = "Nickel";
                spawnedResourceMeters.Add(myResourceMeter);
                resourceMeterLocations.RemoveAt(i);
                break;
            }
        }
        else if (name == "Silver")
        {
            resource = 4;
            for (int i = 0; i < resourceMeterLocations.Count; i++)
            {
                GameObject newResourceMeter = Instantiate(resourceMeter, resourceMeterLocations[i].transform.position, Quaternion.identity);
                newResourceMeter.transform.SetParent(mainUIBackground.transform);
                newResourceMeter.transform.localScale = new Vector3(1, 1, 1);
                ResourceMeter myResourceMeter = newResourceMeter.GetComponent <ResourceMeter>();
                myResourceMeter.sliderFillSprite.sprite = myResourceMeter.resourceFill[resource];
                myResourceMeter.resourceFrontSprite.GetComponent <Image>().sprite = myResourceMeter.resourceFront[resource];
                myResourceMeter.resourceAmount.text = playerBattleManagerScript.playerResourcesAmount[resource].ToString();
                myResourceMeter.resourceType        = "Silver";
                spawnedResourceMeters.Add(myResourceMeter);
                resourceMeterLocations.RemoveAt(i);
                break;
            }
        }
        else if (name == "Cobalt")
        {
            resource = 5;
            for (int i = 0; i < resourceMeterLocations.Count; i++)
            {
                GameObject newResourceMeter = Instantiate(resourceMeter, resourceMeterLocations[i].transform.position, Quaternion.identity);
                newResourceMeter.transform.SetParent(mainUIBackground.transform);
                newResourceMeter.transform.localScale = new Vector3(1, 1, 1);
                ResourceMeter myResourceMeter = newResourceMeter.GetComponent <ResourceMeter>();
                myResourceMeter.sliderFillSprite.sprite = myResourceMeter.resourceFill[resource];
                myResourceMeter.resourceFrontSprite.GetComponent <Image>().sprite = myResourceMeter.resourceFront[resource];
                myResourceMeter.resourceAmount.text = playerBattleManagerScript.playerResourcesAmount[resource].ToString();
                myResourceMeter.resourceType        = "Cobalt";
                spawnedResourceMeters.Add(myResourceMeter);
                resourceMeterLocations.RemoveAt(i);
                break;
            }
        }
        else if (name == "Cadmium")
        {
            resource = 6;
            for (int i = 0; i < resourceMeterLocations.Count; i++)
            {
                GameObject newResourceMeter = Instantiate(resourceMeter, resourceMeterLocations[i].transform.position, Quaternion.identity);
                newResourceMeter.transform.SetParent(mainUIBackground.transform);
                newResourceMeter.transform.localScale = new Vector3(1, 1, 1);
                ResourceMeter myResourceMeter = newResourceMeter.GetComponent <ResourceMeter>();
                myResourceMeter.sliderFillSprite.sprite = myResourceMeter.resourceFill[resource];
                myResourceMeter.resourceFrontSprite.GetComponent <Image>().sprite = myResourceMeter.resourceFront[resource];
                myResourceMeter.resourceAmount.text = playerBattleManagerScript.playerResourcesAmount[resource].ToString();
                myResourceMeter.resourceType        = "Cadmium";
                spawnedResourceMeters.Add(myResourceMeter);
                resourceMeterLocations.RemoveAt(i);
                break;
            }
        }
        else if (name == "Iridium")
        {
            resource = 7;
            for (int i = 0; i < resourceMeterLocations.Count; i++)
            {
                GameObject newResourceMeter = Instantiate(resourceMeter, resourceMeterLocations[i].transform.position, Quaternion.identity);
                newResourceMeter.transform.SetParent(mainUIBackground.transform);
                newResourceMeter.transform.localScale = new Vector3(1, 1, 1);
                ResourceMeter myResourceMeter = newResourceMeter.GetComponent <ResourceMeter>();
                myResourceMeter.sliderFillSprite.sprite = myResourceMeter.resourceFill[resource];
                myResourceMeter.resourceFrontSprite.GetComponent <Image>().sprite = myResourceMeter.resourceFront[resource];
                myResourceMeter.resourceAmount.text = playerBattleManagerScript.playerResourcesAmount[resource].ToString();
                myResourceMeter.resourceType        = "Iridium";
                spawnedResourceMeters.Add(myResourceMeter);
                resourceMeterLocations.RemoveAt(i);
                break;
            }
        }
        else if (name == "Paladium")
        {
            resource = 8;
            for (int i = 0; i < resourceMeterLocations.Count; i++)
            {
                GameObject newResourceMeter = Instantiate(resourceMeter, resourceMeterLocations[i].transform.position, Quaternion.identity);
                newResourceMeter.transform.SetParent(mainUIBackground.transform);
                newResourceMeter.transform.localScale = new Vector3(1, 1, 1);
                ResourceMeter myResourceMeter = newResourceMeter.GetComponent <ResourceMeter>();
                myResourceMeter.sliderFillSprite.sprite = myResourceMeter.resourceFill[resource];
                myResourceMeter.resourceFrontSprite.GetComponent <Image>().sprite = myResourceMeter.resourceFront[resource];
                myResourceMeter.resourceAmount.text = playerBattleManagerScript.playerResourcesAmount[resource].ToString();
                myResourceMeter.resourceType        = "Paladium";
                spawnedResourceMeters.Add(myResourceMeter);
                resourceMeterLocations.RemoveAt(i);
                break;
            }
        }
    }
コード例 #16
0
 // Use this for initialization
 void Start()
 {
     myToggle = GetComponent <Toggle>();
     playerBattleManagerScript = playerBattleManager.GetComponent <PlayerBattleManager>();
     myOriginalUnits           = new List <GameObject>();
 }