Esempio n. 1
0
        public override void Start()
        {
            _physics = GetComponent <SpiritPhysicsComponent>();

            // 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 SpiritTree(this);

            Pontification.SceneManagement.SceneInfo.AIEnteties.Add(this);

            // Get ability manager.
            _abilities = GetComponent <AbilityManager>();
            if (_abilities == null)
            {
                Scheduler.Instance.AddTask(addAbilityManager());
            }
        }
Esempio n. 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 <SpiritPhysicsComponent>();

            // Hook into physics events.
            if (_physics != null)
            {
                _physics.OnFormChange  = onFormChanged;
                _physics.OnStateChange = onStateChanged;
            }

            _currentForm = SpiritForm.SF_BALL;
            playAnimation("BallIdle");
        }
        public override void Start()
        {
            _charPhysics   = GetComponent <CharacterPhysicsComponent>();
            _spiritPhysics = GetComponent <SpiritPhysicsComponent>();

            if (PlayingAnimation != "None" || PlayingAnimation != "")
            {
                SetAnimation(PlayingAnimation);
            }
        }
        public override void Start()
        {
            _physics = GetComponent <SpiritPhysicsComponent>();
            if (_physics == null)
            {
                throw new ArgumentNullException("Spirits need a SpiritPhysicsComponent to work properly");
            }

            _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, true);
        }