コード例 #1
0
        private void Start()
        {
            if (ActorController == null)
            {
                ActorController = GetComponent <ActorController>();
            }

            if (ActorController == null)
            {
                Debug.LogError($"{nameof(BossComponent)} on {gameObject.name} has no {nameof(ActorController)}");
                enabled = false;
                return;
            }

            if (InteractionComponent == null)
            {
                InteractionComponent = GetComponent <ActorInteractionComponent>();
            }

            if (EnableMessaging)
            {
                QdmsMessageBus.Instance.PushBroadcast(new QdmsKeyValueMessage("RpgBossAwake", "Target", GetTooltip()));
            }

            LastKnownHealth = ActorController.Health / ActorController.MaxHealth;
        }
コード例 #2
0
        public override void Start() //TODO register into a list for AI and stuff
        {
            base.Start();

            //TODO may remove some warnings, TODO change to Debug.Log

            if (AnimationComponent == null)
            {
                AnimationComponent = GetComponent <ActorAnimationComponent>();
            }
            if (AnimationComponent == null)
            {
                CDebug.LogEx(name + " couldn't find AnimationComponent", LogLevel.Warning, this);
            }

            if (MovementComponent == null)
            {
                MovementComponent = GetComponent <ActorMovementComponentBase>();
            }
            if (MovementComponent == null)
            {
                CDebug.LogEx(name + " couldn't find MovementComponent", LogLevel.Error, this);
            }

            if (AttackComponent == null)
            {
                AttackComponent = GetComponent <ActorAttackComponent>();
            }
            if (AttackComponent == null)
            {
                CDebug.LogEx(name + " couldn't find AttackComponent", LogLevel.Warning, this);
            }

            if (InteractionComponent == null)
            {
                InteractionComponent = GetComponent <ActorInteractionComponent>();
            }
            if (InteractionComponent == null)
            {
                CDebug.LogEx(name + " couldn't find InteractionComponent", LogLevel.Warning, this);
            }

            InitialPosition = transform.position;

            MovementComponent.Init();

            if (InteractComponent == null)
            {
                InteractComponent = GetComponent <ActorInteractableComponent>();
            }

            if (InteractComponent == null)
            {
                InteractComponent = GetComponentInChildren <ActorInteractableComponent>();
            }

            InteractionComponent.Ref()?.Init();

            if (InteractComponent != null && InteractionComponent != null)
            {
                InteractComponent.ControllerOnInteractDelegate = InteractionComponent.OnInteract;
                InteractComponent.Tooltip = InteractionComponent.Tooltip;
                //TODO may move this to ActorInteractionComponent
            }
            else
            {
                CDebug.LogEx(name + " couldn't find ActorInteractableComponent", LogLevel.Error, this);
            }

            MaxHealth = Health;

            AnimationComponent.Init();
            EnterState(CurrentAiState);
        }