コード例 #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
        private System.Collections.IEnumerator getAbilityManager()
        {
            yield return(TimeSpan.FromSeconds(0.1f));

            _abilities = GetComponent <AbilityManager>();
            _abilities.StateChanged += changeAbilityAnimations;
        }
コード例 #4
0
ファイル: ShootAbility.cs プロジェクト: SwamyDev/dogma-engine
        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()
        {
            _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);

            _ownerStats = GetComponent <CharacterStats>();
        }
コード例 #6
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;
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        System.Collections.IEnumerator addAbilityManager()
        {
            yield return(TimeSpan.FromSeconds(0.1f));

            _abilities = GetComponent <AbilityManager>();
        }