Ejemplo n.º 1
0
    // 터렛 정보 얻기
    public void Bullet_State()
    {
        TurretControl state = transform.parent.GetComponent <TurretControl>();

        damage = state.damage;
        Tag();
    }
Ejemplo n.º 2
0
    // Start is called before the first frame update
    void Start()
    {
        if (!turretScript)
        {
            turretScript = GameObject.Find("Turret").GetComponent <TurretControl>();
        }
        if (!dataScript)
        {
            dataScript = GameObject.Find("SerialData").GetComponent <Data>();
        }

        if (dataScript.serialPort == null || dataScript.serialPort == "")
        {
            port = "COM3";
        }
        else
        {
            port = dataScript.serialPort;
        }

        stream             = new SerialPort(port, 9600);
        stream.ReadTimeout = 50;
        stream.Open();
        // Hardcoded String expected from Arduino sketch
        stream.Write("A");

        timer   = 0;
        seconds = 5;
    }
Ejemplo n.º 3
0
 private void outlineTurret(TurretControl newTurretControl)
 {
     for (var i = 0; i < turretOutlines.Count; i++)
     {
         turretOutlines[i].outlineSize = i == (int)newTurretControl ? OutlineWidth : 0;
     }
 }
Ejemplo n.º 4
0
    /// <summary>
    /// Spawns a turret for each specified target location
    /// </summary>
    /// <param name="targetLocations">Array of gameobject used as a target reference for where the turret goes to</param>
    public void SpawnTurrets(GameObject[] targetLocations)
    {
        if (targetLocations != null)
        {
            //Essentially resets arrays and sets new lengths
            _spawnedTurrets = new TurretControl[targetLocations.Length];

            //Spawns a turret and chain for each given location
            for (int x = 0; x < targetLocations.Length; x++)
            {
                TurretControl control = Instantiate(turretPrefab, transform.position, transform.rotation).GetComponent <TurretControl>();
                _spawnedTurrets[x] = control;

                control.targetLocationObj = targetLocations[x];
                control.isMoving          = true;

                //Spawns a random attack onto the turret
                Instantiate(turretAttacks[Random.Range(0, turretAttacks.Length)], control.transform);

                ChainHandler chain = Instantiate(_chainPrefab, transform.position, transform.rotation).GetComponent <ChainHandler>();
                chain.targetObj = control.gameObject;
                chain.bossObj   = gameObject;
                _spawnedChains.Add(chain);
            }
        }

        StartCoroutine(SetupTurret());
    }
Ejemplo n.º 5
0
 void Start()
 {
     controlObject = GameObject.Find("Turret");
     if (controlObject != null)
     {
         control = controlObject.GetComponent<TurretControl>();
     }
 }
Ejemplo n.º 6
0
 void Awake()
 {
     shooterControl  = turret.GetComponent <ShooterControl>();
     turretControl   = turret.GetComponent <TurretControl>();
     hoodControl     = hood.GetComponent <HoodControl>();
     flywheelControl = flywheel.GetComponent <FlywheelControl>();
     intakeControl   = intake.GetComponent <IntakeControl>();
 }
Ejemplo n.º 7
0
    void Awake()
    {
        turretControl   = turret.GetComponent <TurretControl>();
        hoodControl     = hood.GetComponent <HoodControl>();
        flywheelControl = flywheel.GetComponent <FlywheelControl>();
        intakeControl   = intake.GetComponent <IntakeControl>();

        timer = Time.time;
    }
 public void StartPlacing(GameObject towertemp)
 {
     if (placing == false)
     {
         placing       = true;
         tower         = towertemp;
         turretControl = tower.GetComponent <TurretControl> ();
         SetSpriteScale();
     }
 }
Ejemplo n.º 9
0
 // Use this for initialization
 void Start()
 {
     towerButtomImages = new Texture[towerObjects.Length];
     towerCost         = new int[towerObjects.Length];
     for (int i = 0; i < towerObjects.Length; i++)
     {
         TurretControl turretControl = towerObjects [i].GetComponent <TurretControl> ();
         towerCost [i] = turretControl.cost;
     }
 }
Ejemplo n.º 10
0
    void OnTriggerEnter2D(Collider2D coll)
    {
        if (coll.gameObject.tag == "Player")
        {
            Destroy(this.gameObject);

            ///DEAL DAMAGE TO PLAYER
            TurretControl target = coll.gameObject.GetComponent <TurretControl> ();
            TargetHit(target);
            ///
        }
    }
Ejemplo n.º 11
0
    //태그 변경
    //스킬일경우 체크 스킬이아니면 터렛ㅌㅐ그
    //스킬이면 스킬태그로 파이어함
    private void Tag()
    {
        if (this.gameObject.tag == "Skill")
        {
            gameObject.tag = string.Format(Skill7777.skillName);
        }
        else
        {
            TurretControl state = transform.parent.GetComponent <TurretControl>();
            switch (state.turretLevel)
            {
            case 2:
                gameObject.tag = "Bullet1";
                break;

            case 3:
                gameObject.tag = "Bullet2";
                break;

            case 4:
                gameObject.tag = "Bullet3";
                break;

            case 5:
                gameObject.tag = "Bullet4";
                break;

            case 6:
                gameObject.tag = "Bullet5";
                break;

            case 7:
                gameObject.tag = "Bullet6";
                break;

            case 8:
                gameObject.tag = "Bullet7";
                break;

            case 9:
                gameObject.tag = "Bullet8";
                break;

            case 10:
                gameObject.tag = "Bullet9";
                break;
            }
        }
    }
Ejemplo n.º 12
0
    // Use this for initialization
    void Start()
    {
        if (!serialManager)
        {
            serialManager = GameObject.Find("GameManager").GetComponent <SerialManager>();
        }

        //Determine initial position based on Transform
        position = transform.position;
        //Setup camera variables
        cam    = Camera.main;
        height = 2f * cam.orthographicSize;
        width  = height * cam.aspect;

        turretScript = gameObject.GetComponentInChildren <TurretControl>();
    }
Ejemplo n.º 13
0
        public Program()

        {
            // The constructor, called only once every session and
            // always before any other method is called. Use it to
            // initialize your script.
            //
            // The constructor is optional and can be removed if not
            // needed.
            //
            // It's recommended to set RuntimeInfo.UpdateFrequency
            // here, which will allow your script to run itself without a
            // timer block.

            turretControl = new TurretControl(this, Me);
        }
Ejemplo n.º 14
0
        private void HandleHorizontalPressed(InputValue inputValue)
        {
            switch (inputValue.Get <float>())
            {
            case -1:
                turretControl = TurretControl.Left;
                break;

            case 0:
                turretControl = TurretControl.Center;
                break;

            case 1:
                turretControl = TurretControl.Right;
                break;
            }

            outlineTurret(turretControl);
        }
Ejemplo n.º 15
0
    }     // End KillUnit()

    /**
     * Removes HP from the unit
     * @param hp - The amount of hp to take.
     * @param towerType - The type of tower dealing the damage.
     * */
    public void TakeHit(int hp, string towerType, TurretControl turretControl)
    {
        // Flash the unit's button red on hit
        GameObject.Find(UnitButton.name + "/UnitBKG").GetComponent <UISprite> ().color = new Color(.9f, .1f, .1f);
        StartCoroutine(ChangeLabelColorBack());

        // Push a notification to the console:
        Console.Push("Unit " + GameVars.UCFirst(Type) + " has been hit!");

        Debug.Log(Type);
        // We will use this for special abilities. ;)
        switch (towerType)
        {
        case "Flamethrower":



            if (Type == "firefighter")
            {
                Debug.Log("HERE");
                turretControl.RotationSpeed = 0;
                turretControl.HitPercentage = 0;
                turretControl.HPOnHit       = 0;
                turretControl.Range         = 0;
                turretControl.setTowerTint(new Color(.3f, .3f, .3f));
            }

            break;

        default:
            break;
        }         // End switch

        if (HP > 0)
        {
            StartCoroutine(TakeHP(hp));
        }
    }     // End TakeHit()
Ejemplo n.º 16
0
 void Awake()
 {
     pGui = transform.parent.gameObject.GetComponent<PlayerGui> ();
     teamIdentity = transform.parent.gameObject.GetComponent<TeamIdentity> ();
     turretControl = GetComponent<TurretControl> ();
 }
Ejemplo n.º 17
0
 void Start()
 {
     turretControl = GetComponent <TurretControl>();
 }
Ejemplo n.º 18
0
 void TargetHit(TurretControl player)
 {
     player.playerHealth -= enemyProjectileDamage;
     print("Player health - " + player.playerHealth);
 }
Ejemplo n.º 19
0
 // store references to everything we need
 void Awake()
 {
     control = GetComponent<TurretControl> ();
     weapon = GetComponent<Weapon> ();
     parentIdentity = transform.parent.GetComponent<NetworkIdentity> ();
 }
 void Awake()
 {
     turretData = turret.GetComponent <TurretControl>();
 }
Ejemplo n.º 21
0
 private void Start()
 {
     turretControl = GetComponentInChildren <TurretControl>();
 }
Ejemplo n.º 22
0
    // touch input

    public void fire()
    {
        TurretControl i = GameObject.FindGameObjectWithTag("Player").GetComponent <TurretControl> ();

        i.fire();
    }
 //Initializes the hardpoint with the needed stuff regardless of whatever else exists.
 public void Start()
 {
     turret = this.transform.parent.GetComponentInChildren<TurretControl>();
     ship = this.transform.root.GetComponent<ShipManager>();
     //activate();
 }
 public void findTurretControl()
 {
     turret = this.transform.parent.GetComponentInChildren<TurretControl>();
 }
 void Start()
 {
     render  = GetComponent <MeshRenderer>();
     control = GetComponentInParent <TurretControl>();
     render.material.color = Color.black;
 }
 public void clearTurretControl()
 {
     turret = null;
 }
Ejemplo n.º 27
0
 public void StartUpgrading(GameObject turret)
 {
     upgrading       = true;
     upgradingTurret = turret;
     turretControl   = upgradingTurret.GetComponent <TurretControl> ();
 }