public override void Activate(GameObject parent)
    {
        Transform mineLocation = parent.GetComponent <GunPosition>().shootPosition;
        //Create a landmine at the start position
        GameObject landmineInstance = Instantiate(landMine, mineLocation.transform.position, Quaternion.identity);
        BotSensor  sensor           = parent.GetComponentInParent <BotSensor>();
        int        enemyLayer       = sensor.GetEnemyLayer();
        //Fetch script/data for landmine
        Landmine projectileScript = landmineInstance.GetComponent <Landmine>();

        //Tells landmine values
        projectileScript.SetValues(damage, projectileSize, enemyLayer);

        // call a destroy function on landmineInstance

        //TODO: Set landmine knockback
    }
Exemple #2
0
    public void BackStep()
    {
        // drop landmines
        if (isRunning)
        {
            if (!IsPartCoolingDown())
            {
                ResetCooldownTimer();

                //Create a landmine at the start position
                GameObject landmineInstance = Instantiate(landmine, projectileStartPos.transform.position, Quaternion.identity);

                //Fetch script/data for landmine
                Landmine projectileScript = landmineInstance.GetComponent <Landmine>();

                //Tells landmine values
                projectileScript.SetValues(damage, projectileSize, enemyLayer);

                // call a destroy function on landmineInstance

                //TODO: Set landmine knockback
            }
        }
    }