コード例 #1
0
 void OnTriggerExit2D(Collider2D other)
 {
     if (other.gameObject.GetComponent <GameUnit>().unitIsTargetable() == true)
     {
         UnitData.enemyTarget = UnitUtils.FindObjectNearestToEndToEndOfSpline(gameObject, "Units");
     }
 }
コード例 #2
0
 void OnTriggerEnter2d(Collider other)
 {
     //_OnTriggerStay2d_delegate(ObjectsContainer, other);
     if (other.gameObject.GetComponent <GameUnit>().unitIsTargetable() == true)
     {
         UnitData.enemyTarget = UnitUtils.FindObjectNearestToEndToEndOfSpline(gameObject, "Units");
     }
 }
コード例 #3
0
ファイル: WeaponController.cs プロジェクト: kobi666/TDM
    // Update is called once per frame
    void Update()
    {
        if (FireRateTimer <= 0)
        {
            Target = UnitUtils.FindObjectNearestToEndToEndOfSpline(gameObject, "Units");
        }

        if (Target && FireRateTimer <= 0)
        {
            Points[1] = Target.transform.position;
            LineRend.SetPositions(Points);
            FireProjectileWeapon(Target);
            Target = null;
        }

        FireRateTimer -= Time.deltaTime;
    }