Exemple #1
0
    private void Update()
    {
        if (health.IsDead())
        {
            return;
        }
        if (personality != null)
        {
            personality.Update();
        }


        //Enable diagnostic
        if (Input.GetMouseButtonDown(2))
        { // if left button pressed...
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit))
            {
                if (!hit.collider.gameObject.tag.Equals("Enemy"))
                {
                    Diagnostic.Instance.SetEnabled(false);
                }

                if (hit.collider.gameObject == this.gameObject)
                {
                    Diagnostic.Instance.SetEnabled(true);
                    Diagnostic.Instance.setReference(this.gameObject);
                }
            }
        }
        Diagnostic.Instance.UpdateAmmo(this.gameObject, rifle.Ammo);
    }
Exemple #2
0
 protected override void updateMovement()
 {
     if (Crystals == null)
     {
         init();
     }
     Personality.Update();
 }
Exemple #3
0
        protected override void updateMovement()
        {
            List <Sprite> targets = (This.Game.CurrentLevel as FrostbyteLevel).allies;
            Sprite        target  = GetClosestTarget(targets, 600f);

            if (target != null)
            {
                Personality.Update();
            }
        }
Exemple #4
0
        protected override void updateMovement()
        {
            List <Sprite> targets = (This.Game.CurrentLevel as FrostbyteLevel).allies;
            Sprite        target  = GetClosestTarget(targets, float.MaxValue);

            if (target != null)
            {
                float attackRadius = ((target.GetCollision()[0] as Collision_BoundingCircle).Radius + (this.GetCollision()[0] as Collision_BoundingCircle).Radius) * .92f;
                if (Vector2.DistanceSquared(target.GroundPos, this.GroundPos) > attackRadius * attackRadius)
                {
                    Personality.Update();
                }
            }
        }
Exemple #5
0
        protected override void updateMovement()
        {
            List <Sprite> targets = (This.Game.CurrentLevel as FrostbyteLevel).allies;
            Sprite        target  = GetClosestTarget(targets, float.MaxValue);

            if (target != null && target.GetCollision().Count > 0 && GetCollision().Count > 0)
            {
                float theirRad     = (target.GetCollision().FirstOrDefault() as Collision_BoundingCircle).Radius;
                float rad          = (target.GetCollision().FirstOrDefault() as Collision_BoundingCircle).Radius;
                float attackRadius = (rad + theirRad) * .92f;
                if (Vector2.DistanceSquared(target.GroundPos, this.GroundPos) > attackRadius * attackRadius)
                {
                    Personality.Update();
                }
            }
        }
Exemple #6
0
 protected override void updateMovement()
 {
     Personality.Update();
 }