예제 #1
0
        public override void Start()
        {
            _physics = GetComponent <CharacterPhysicsComponent>();

            // Populate memory sheet.
            _stats               = GetComponent <CharacterStats>();
            _memory.Health       = _stats.Health;
            _memory.MemoryBuffer = _memoryBuffer;
            _memory.VisionRange  = _visionRange;
            _memory.VisionAngle  = _visionAngle;
            _memory.Category     = _stats.Category;
            _memory.Enemies      = new List <GameObject>();
            _memory.Facing       = 1;

            // Create behaviour tree.
            _behaviourTree = new GuardTree(this);

            SceneInfo.AIEnteties.Add(this);

            // Get ability manager.
            _abilities = GetComponent <AbilityManager>();
            if (_abilities == null)
            {
                Scheduler.Instance.AddTask(addAbilityManager());
            }
        }
예제 #2
0
        public override void Start()
        {
            // Get animation components.
            var anims = GetComponents <AnimationComponent>();

            _animations = new Bag <AnimationComponent>(anims.Count);
            anims.ForEach((anim) =>
            {
                anim.Sprite.AnimationFinished += animationFinished;
                _animations.Add(anim);
            });

            // Get source components.
            _physics   = GetComponent <CharacterPhysicsComponent>();
            _abilities = GetComponent <AbilityManager>();

            // Hook into physics events.
            if (_physics != null)
            {
                _physics.StateChanged += changePhysicsAnimations;
            }

            if (_abilities == null)
            {
                // Try a few frames later again.
                Scheduler.Instance.AddTask(getAbilityManager());
            }
            else
            {
                _abilities.StateChanged += changeAbilityAnimations;
            }
        }
예제 #3
0
        public override void Start()
        {
            _charPhysics   = GetComponent <CharacterPhysicsComponent>();
            _spiritPhysics = GetComponent <SpiritPhysicsComponent>();

            if (PlayingAnimation != "None" || PlayingAnimation != "")
            {
                SetAnimation(PlayingAnimation);
            }
        }
예제 #4
0
        public override void Start()
        {
            _physics = GetComponent<CharacterPhysicsComponent>();
            _manager = GetComponent<AbilityManager>();

            // If not present in the current game object add it.
            if (_manager == null)
                _manager = AddComponent<AbilityManager>();

            // Add ability to manager
            _manager.AddAbility(this, false);
            _timeSinceLastShot = FireRate;
        }
예제 #5
0
        public override void Start()
        {
            _physics = GetComponent <CharacterPhysicsComponent>();
            _manager = GetComponent <AbilityManager>();

            // If not present in the current game object add it.
            if (_manager == null)
            {
                _manager = AddComponent <AbilityManager>();
            }

            // Add ability to manager
            _manager.AddAbility(this);

            // Hook into pre update
            GameObject.Scene.PreUpdate += preUpdate;
        }