Пример #1
0
    public override void Start()
    {
        base.Start();

        _teleportation        = GetComponent <Teleportation>();
        _movement             = GetComponent <SidescrollingMovement>();
        _hitboxes             = GetComponentInChildren <HitboxController>();
        _spiralProjectileSpam = GetComponent <SpiralProjectileSpam>();

        _actions = new List <Action>
        {
            MoveToPlayer,
            AttackPlayer,
            TeleportBehindPlayer,
            MoveToPlayer,
            AttackPlayer,
            TeleportToCenter,
            SpamMagic,
            TeleportBehindPlayer,
        };

        _originalPosition = transform.position;
        _currentAnimation = IdleLeft;
        _isFacingLeft     = true;
    }
Пример #2
0
    public void OnTriggerStay(Collider who)
    {
        if (!AffectedTags.Contains(who.tag) ||
            _affectedObject != null)
        {
            return;
        }

        _affectedObject = who.gameObject;
        _moveSystem     = _affectedObject.GetComponent <SidescrollingMovement>();
        if (_moveSystem != null)
        {
            if (DebugMode)
            {
                Debug.Log("Webbing has snared " + _affectedObject.name);
            }

            _moveSystem.AllowHorizontalMovement = false;
        }
        else
        {
            if (DebugMode)
            {
                Debug.Log(_affectedObject.name + " has no Sidescrolling Movement to restrain...");
            }
        }
    }
Пример #3
0
    // Use this for initialization
    public override void Start()
    {
        _originalPosition = transform.position;

        base.Start();
        _movement = GetComponent <SidescrollingMovement>();
        _hitboxes = GetComponentInChildren <HitboxController>();

        _states = new StateMachine(new List <State> {
            new State {
                Condition = DefaultCondition, Behavior = GuardOriginalPosition
            },
            new State {
                Condition = SeesPlayer, Behavior = MoveTowardPlayer
            },
            new State {
                Condition = InRange, Behavior = FenceWithPlayer
            },
            new State {
                Condition = PlayerIsJumping, Behavior = MoveTowardPlayer
            },
            new State {
                Condition = IsHit, Behavior = BeHit
            }
        });
    }
    private void ApplyKnockback(Collider who)
    {
        SidescrollingMovement movement = who.gameObject.GetComponent <SidescrollingMovement>();

        if (movement != null)
        {
            movement.RepelFromObject(gameObject, DamageForce);
        }
        else
        {
            DebugMessage(who.gameObject.name + " has no Sidescrolling Movement.");
        }
    }
Пример #5
0
    public void Start()
    {
        _movement = GetComponent<SidescrollingMovement>();
        _sprite = GetComponentInChildren<SpriteSystem>();
        _sense = GetComponentInChildren<PlayerSense>();

        List<State> machineStates = new List<State>{
            new State{Condition = () => true, Behavior = Patrol},
            new State{Condition = SensePlayer, Behavior = FightOrFlight},
            new State{Condition = IsHit, Behavior = BeHit}
        };

        _states = new StateMachine(machineStates);
    }
Пример #6
0
    public void RepelAttacker(GameObject source)
    {
        GameObject root = source.transform.root.gameObject;

        if (root == null)
        {
            return;
        }

        SidescrollingMovement movement = root.GetComponent <SidescrollingMovement>();

        if (movement == null)
        {
            return;
        }

        movement.RepelFromObject(gameObject, RepelForce);
    }
Пример #7
0
    public void RepelDamagedEntity(GameObject target)
    {
        GameObject root = target;

        if (root == null)
        {
            return;
        }

        SidescrollingMovement move = root.GetComponent <SidescrollingMovement>();

        if (move == null)
        {
            return;
        }

        move.RepelFromObject(gameObject, RepelForce);
    }
Пример #8
0
    public override void Start()
    {
        base.Start();
        _movement = GetComponent <SidescrollingMovement>();

        List <State> machineStates = new List <State> {
            new State {
                Condition = () => true, Behavior = Patrol
            },
            new State {
                Condition = SensePlayer, Behavior = FightOrFlight
            },
            new State {
                Condition = IsHit, Behavior = BeHit
            }
        };

        _states = new StateMachine(machineStates);
    }
Пример #9
0
    public void OnTriggerStay(Collider who)
    {
        if(! AffectedTags.Contains(who.tag)
           || _affectedObject != null)
            return;

        _affectedObject = who.gameObject;
        _moveSystem = _affectedObject.GetComponent<SidescrollingMovement>();
        if(_moveSystem != null)
        {
            if(DebugMode)
                Debug.Log("Webbing has snared " + _affectedObject.name);

            _moveSystem.CanMove = false;
        }
        else
        {
            if(DebugMode)
                Debug.Log(_affectedObject.name + " has no Sidescrolling Movement to restrain...");
        }
    }
Пример #10
0
    public override void Start()
    {
        base.Start();
        _snout    = GetComponentInChildren <ProjectileProjector>();
        _movement = GetComponent <SidescrollingMovement>();

        List <State> states = new List <State>
        {
            new State {
                Condition = () => true, Behavior = DoNothing
            },
            new State {
                Condition = PlayerNearby, Behavior = ChooseAction
            },
            new State {
                Condition = IsHit, Behavior = DoNothing
            }
        };

        _fsm = new StateMachine(states);
    }
Пример #11
0
 private void Start()
 {
     _movement = GetComponent <SidescrollingMovement>();
 }
Пример #12
0
 public virtual void Start()
 {
     _control   = ControlManager.Instance;
     _movement  = GetComponent <SidescrollingMovement>();
     _animation = GetComponent <SidescrollingAnimationController>();
 }
Пример #13
0
 public void Start()
 {
     _maestro   = (Maestro)FindObjectOfType(typeof(Maestro));
     _movement  = gameObject.GetComponent <SidescrollingMovement>();
     _animation = GetComponent <PlayerAnimationManager>();
 }
Пример #14
0
    void Start()
    {
        _snout = GetComponentInChildren<ProjectileProjector>();
        _movement = GetComponent<SidescrollingMovement>();
        _sprite = GetComponentInChildren<SpriteSystem>();

        List<State> states = new List<State>
        {
            new State{ Condition = () => true, Behavior = DoNothing },
            new State{ Condition = PlayerNearby, Behavior = ChooseAction },
            new State{ Condition = IsHit, Behavior = DoNothing }
        };

        _fsm = new StateMachine(states);
    }
Пример #15
0
 public virtual void Start()
 {
     _movement = GetComponent <SidescrollingMovement>();
     _sprite   = GetComponentInChildren <AsvarduilSpriteSystem>();
 }
Пример #16
0
 public void Start()
 {
     _movement = gameObject.GetComponent<SidescrollingMovement>();
     _animation = gameObject.GetComponentInChildren<SpriteSystem>();
     _hitboxController = gameObject.GetComponentInChildren<HitboxController>();
 }
Пример #17
0
 public void Start()
 {
     _health   = GetComponent <HealthController>();
     _movement = GetComponent <SidescrollingMovement>();
 }
	public virtual void Start()
	{
		_control = ControlManager.Instance;
		_movement = GetComponent<SidescrollingMovement>();
		_animation = GetComponent<SidescrollingAnimationController>();
	}
Пример #19
0
    // Use this for initialization
    void Start()
    {
        _originalPosition = transform.position;

        _movement = GetComponent<SidescrollingMovement>();
        _animation = GetComponentInChildren<SpriteSystem>();
        _hitboxes = GetComponentInChildren<HitboxController>();
        _sense = GetComponentInChildren<PlayerSense>();

        _states = new StateMachine(new List<State> {
            new State {Condition = DefaultCondition, Behavior = GuardOriginalPosition},
            new State {Condition = SeesPlayer, Behavior = MoveTowardPlayer},
            new State {Condition = InRange, Behavior = FenceWithPlayer},
            new State {Condition = PlayerIsJumping, Behavior = MoveTowardPlayer},
            new State {Condition = IsHit, Behavior = BeHit}
        });
    }
	public virtual void Start()
	{
		_movement = GetComponent<SidescrollingMovement>();
		_sprite = GetComponentInChildren<AsvarduilSpriteSystem>();
	}