예제 #1
0
    void StartDogfight(Collider other)
    {
        if (GetComponent <PlaneTouchReciever> ().TrailTouch != null)
        {
            GameObject.Destroy(GetComponent <PlaneTouchReciever> ().TrailTouch);
        }

        Debug.Log("Dogfighting");

        dogFighting = true;

        dogfightCenter = transform.position + ((other.gameObject.transform.position - transform.position) / 2.0f);

        //dogfightCenter = transform.TransformPoint(dogfightCenter);

        // GameObject newSphere = (GameObject)Instantiate(spherePrefab, transform);
        // newSphere.transform.position = dogfightCenter;

        this.rangeCollider.radius = this.rangeCollider.radius * 2.0f;

        otherPlaneGameObject = other.gameObject;

        GeneralPlane enemyPlaneComponent = otherPlaneGameObject.GetComponent <EnemyPlane>();
        GeneralPlane myPlaneComponent    = GetComponent <AllyPlane>();


        enemyPlaneComponent.StartDealingDamage(myPlaneComponent);
        myPlaneComponent.StartDealingDamage(enemyPlaneComponent);
    }
예제 #2
0
 public void StartDealingDamage(GeneralPlane otherPlane)
 {
     adversary = otherPlane;
 }
예제 #3
0
 public void StopDealingDamage()
 {
     adversary = null;
 }
예제 #4
0
 // Use this for initialization
 protected void Start()
 {
     adversary     = null;
     initialHealth = health;
 }