示例#1
0
 internal override void DoStart()
 {
     RegisterInheridedOrderStateOptions(typeof(OPTIONS));
     movement = this.GetComponent <Movability>();
     this.gameObject.GetComponent <Pilot>().mySpace = this.gameObject.GetComponent <SphereCollider>();
     GetComponent <Pilot>().Controlls = movement;
     //  GetComponent<SphereCollider>().isTrigger = true;
     //movement.WayPoints.Add(new Vector3(120, 0, 25));
     //movement.WayPoints.Add(new Vector3(70, 0, -25));
 }
示例#2
0
 internal override void DoStart()
 {
     RegisterInheridedOrderStateOptions(typeof(OPTIONS));
     movement = this.GetComponent<Movability>();
     this.gameObject.GetComponent<Pilot>().mySpace = this.gameObject.GetComponent<SphereCollider>();
     GetComponent<Pilot>().Controlls = movement;
     //  GetComponent<SphereCollider>().isTrigger = true;
     //movement.WayPoints.Add(new Vector3(120, 0, 25));
     //movement.WayPoints.Add(new Vector3(70, 0, -25));
 }
示例#3
0
        public void Move_UpdatesTheLocationOfTheUnitAccordingly(IUnit<Archer> unit, ITile destination)
        {
            // :::: ARRANGE ::::
            var movableUnit = new Movability<Archer>(unit);

            // :::: ACT ::::
            movableUnit.MoveTo(destination);

            // :::: ASSERT ::::
            unit.Location.Should().Be(destination);
        }
示例#4
0
    /* Start & Awake & Update */
    void Awake()
    {
        Controlls = this.gameObject.GetComponent <Movability>();
        My        = gameObject.GetComponent <UnitScript>();

        if (!mySpace)
        {
            if ((!this.gameObject.GetComponent <SphereCollider>()) && (!this.gameObject.GetComponentInChildren <SphereCollider>()))
            {
                this.gameObject.AddComponent <SphereCollider>().isTrigger = true;
            }
        }
    }
示例#5
0
    private bool Attack()
    {
        if (GetComponent <Gunner>())
        {
            GetComponent <Gunner>().DoUpdate();
        }

        if (UNIT.Options.Target)
        {
            AttackPoint = UNIT.Options.Target.transform.position;
            if (!UNIT.IsABuilding)
            {
                Movability Movement = GetComponent <Movability>();
                Movement.IsMoving        = true;
                Movement.MovingDirection = UNIT.Options.MoveToPoint;

                if (Movement.Distance < UNIT.AttackRange)
                {
                    UNIT.weapon.Reload();
                    UNIT.weapon.Engage(UNIT.Options.Target);
                }

                return(UNIT.Options.Target);
            }
            else
            {
                if (Vector3.Distance(this.gameObject.transform.position, AttackPoint) <= UNIT.AttackRange)
                {
                    UNIT.weapon.Reload();
                    UNIT.weapon.Engage(UNIT.Options.Target);
                }
            }
            return((bool)UNIT.Options.Target);
        }
        else
        {
            return(false);
        }
    }
示例#6
0
    /* Start & Awake & Update */
    void Awake()
    {

        Controlls = this.gameObject.GetComponent<Movability>();
        My = gameObject.GetComponent<UnitScript>();

        if (!mySpace)
            if ((!this.gameObject.GetComponent<SphereCollider>())&&(!this.gameObject.GetComponentInChildren<SphereCollider>()))
                this.gameObject.AddComponent<SphereCollider>().isTrigger = true;



    }