Exemple #1
0
        public override void Init()
        {
            movementController    = GetComponent <PlayerMovementController>();
            actionController      = GetComponent <PlayerActionController>();
            rotationController    = GetComponent <PlayerRotationController>();
            animationController   = GetComponent <PlayerAnimationController>();
            inventoryController   = GetComponent <PlayerInventoryController>();
            weaponController      = GetComponent <PlayerWeaponController>();
            healthController      = GetComponent <HealthController>();
            reloadController      = GetComponent <PlayerReloadController>();
            interactionController = GetComponent <InteractionSearcherController>();
            executionController   = GetComponent <PlayerExecutionController>();
            limbsController       = GetComponentInChildren <LimbsController>();
            hitboxController      = GetComponentInChildren <HitboxController>();
            abilityController     = GetComponent <AbilityController>();

            tickPlayer.value = true;

            movementController.Init();
            actionController.Init();
            rotationController.Init();
            animationController.Init();
            weaponController.Init();
            inventoryController.Init();
            healthController.Init();
            reloadController.Init();
            interactionController.Init();
            executionController.Init();
            limbsController.Init();
            hitboxController.Init();
            abilityController.Init();
        }
Exemple #2
0
        public override void SetupController(TraitController controller)
        {
            base.SetupController(controller);
            var hitboxFilter = HitboxController.GenerateHitboxFilter(_hitbox, _collisionLayer);

            _controller.gameObject.SendMessageWithFilterTo(new HitboxCheckMessage {
                DoAfter = hitboxController =>
                {
                    _hitboxController = hitboxController;
                }
            }, _controller.transform.parent.gameObject, hitboxFilter);
            if (!_hitboxController)
            {
                _hitboxController = Instantiate(_hitbox.Controller, _controller.transform.parent);
                _hitboxController.Setup(_hitbox, _collisionLayer);
            }
            _register = _applyToTargetOnEnter.Length > 0 || _applyToTargetOnExit.Length > 0 || _applyToSelfOnEnter.Length > 0 || _applyToSelfOnExit.Length > 0;
            if (_register)
            {
                _traitCheckMsg.TraitsToCheck = _requiredTraits;
                _controller.gameObject.SendMessageTo(new RegisterCollisionMessage {
                    Object = _controller.gameObject
                }, _hitboxController.gameObject);
                SubscribeToMessages();
            }
        }
Exemple #3
0
    private void OnTriggerStay(Collider other)
    {
        // if collision should NOT be effected by damage touch
        if (!IsEffectableCollision(other))
        {
            // DONT continue code
            return;
        }

        // if touch damaging is ON a cooldown
        if (onDamageCooldown)
        {
            // DONT continue code
            return;
        }

        // get collididng object's hitbox component
        HitboxController collidingHitbox = other.GetComponent <HitboxController>();

        // if can harm the hitbox target
        if (GeneralMethods.CanHarmHitboxTarget(_charMaster.CharData, collidingHitbox))
        {
            OnTargetTouch(collidingHitbox);
        }
    }
    private void OnTriggerEnter(Collider other)
    {
        // get colliding object's hitbox
        HitboxController collidingHitbox = other.GetComponent <HitboxController>();

        // if hitbox found
        if (collidingHitbox != null)
        {
            // if target CAN hurt caster
            if (collidingHitbox.CharMaster.CharHealth.
                CanAttackerCauseHarmBasedOnReputation(_casterCharData.factionReputation))
            {
                // if trap has already been sprung
                if (isTrapSprung)
                {
                    // apply trap debuff to colliding enemy
                    collidingHitbox.CharMaster.CharStatus.AddStatusEffect(abilityStatusEffect, abilityDuration);
                }
                // else trap has NOT been sprung yet
                else
                {
                    // setup trap state as being sprung
                    SpringTrap();
                }
            }
        }
    }
    private void OnTriggerEnter(Collider other)
    {
        // get colliding object's hitbox
        HitboxController collidingHitbox = other.GetComponent <HitboxController>();

        // if hitbox found
        if (collidingHitbox != null)
        {
            // get health associated with health
            CharacterHealthController collidingHealth = collidingHitbox.CharMaster.
                                                        CharHealth;

            // if colliding char already been healed
            if (healthAlreadyHealed.Contains(collidingHealth))
            {
                // DONT continue code
                return;
            }

            // if hit target is ally of caster
            if (collidingHitbox.CharMaster.CharHealth.AreFactionAllies(
                    _casterCharData.factionReputation))
            {
                // heal hitbox target to full health
                collidingHitbox.CharMaster.CharHealth.HealHealth(_casterCharMaster, 999999);

                // denote that hitbox target has been healed
                healthAlreadyHealed.Add(collidingHealth);
            }
        }
    }
Exemple #6
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
            }
        });
    }
    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;
    }
Exemple #8
0
 /// <summary>
 /// Should be called when a enemy target has been target.
 /// </summary>
 private void OnEnemyTargetDetection(HitboxController collidingHitboxArg)
 {
     // if given valid hitbox
     if (collidingHitboxArg != null)
     {
         // make threat manager aware of colliding character but do not increase the actual threat they pose
         aiThreatManager.MakeAwareOfThreat(collidingHitboxArg.CharMaster);
     }
 }
Exemple #9
0
    protected override void OnContactWithEnemy(HitboxController enemyHitboxArg)
    {
        base.OnContactWithEnemy(enemyHitboxArg);

        // apply weakening debuff to hit target
        enemyHitboxArg.CharMaster.CharStatus.AddStatusEffect(statusEffect, effectDuration);

        // increment number of targets penetrated and despawns if reached penetration limit
        ProcessTargetPenetration();
    }
Exemple #10
0
    protected override void OnContactWithEnemy(HitboxController enemyHitboxArg)
    {
        base.OnContactWithEnemy(enemyHitboxArg);

        // deal weapon damage to hitbox target
        enemyHitboxArg.CharMaster.CharHealth.TakeDamage(charOwner, GetRandomWeaponDamage(),
                                                        transform.position);

        // despawn this pooled object
        DespawnObject();
    }
 public override void InitAbility(AbilityController controller)
 {
     base.InitAbility(controller);
     deltaTimer             = GetResource.DeltaTimer();
     movementController     = controller.GetComponent <PlayerMovementController>();
     isPressingMovementKeys = Resources.Load("Player/Movement/Player - Is Pressing Movement Keys") as ScriptableBool;
     hitboxController       = controller.GetComponent <PlayerController>().hitboxController;
     animController         = controller.GetComponent <PlayerAnimationController>();
     movementInput          = Resources.Load("Player/Movement/Movement Inputs") as PlayerMovementInputs;
     isInAction             = Resources.Load("Player/Actions/Is Player In Action") as ScriptableBool;
 }
    private void OnTriggerEnter(Collider other)
    {
        // get colliding object's hitbox component
        HitboxController collidingHitbox = other.GetComponent <HitboxController>();

        // if the collision was with a player
        if (GeneralMethods.IsPlayerHitbox(collidingHitbox))
        {
            OnPlayerEnterTrigger();
        }
    }
Exemple #13
0
    private void OnTriggerEnter(Collider other)
    {
        // get collididng object's hitbox component
        HitboxController collidingHitbox = other.GetComponent <HitboxController>();

        // if can harm the hitbox target
        if (GeneralMethods.CanHarmHitboxTarget(_charMaster.CharData, collidingHitbox))
        {
            OnEnemyTargetDetection(collidingHitbox);
        }
    }
    protected virtual void OnTriggerEnter(Collider other)
    {
        // get collididng object's hitbox component
        HitboxController collidingHitbox = other.GetComponent <HitboxController>();

        // if can harm the hitbox target
        if (GeneralMethods.CanHarmHitboxTarget(_casterCharData, collidingHitbox))
        {
            // call to denote that made contact with an opposing character
            OnContactWithEnemy(collidingHitbox);
        }
    }
        public override void Init()
        {
            movementController  = GetComponent <AIMovementController>();
            animController      = GetComponent <AnimationController>();
            inventoryController = GetComponent <AIInventoryController>();
            hitboxController    = GetComponentInChildren <HitboxController>();
            limbsController     = GetComponentInChildren <LimbsController>();
            troopController     = GetComponent <AITroopController>();
            healthController    = GetComponent <HealthControllerAI>();
            stateController     = GetComponent <AIStateController>();

            knockDownNotificationCollider.enabled = false;
        }
Exemple #16
0
        public override void Init()
        {
            base.Init();

            aiController        = GetComponent <AIController>();
            movementController  = GetComponent <AIMovementController>();
            animController      = GetComponent <AnimationController>();
            inventoryController = GetComponent <AIInventoryController>();
            hitboxController    = GetComponentInChildren <HitboxController>();
            limbsController     = GetComponentInChildren <LimbsController>();
            knockdownController = GetComponent <AIKnockDownController>();
            aiManager           = aiController.aiManager;
        }
Exemple #17
0
        bool CheckIfHasCorrectCharacterMesh()
        {
            HitboxController controller = GetComponentInChildren <HitboxController>();
            string           currentCharacterGameObjectName = controller.gameObject.name;

            if (currentCharacterGameObjectName == troopData.characterPrefab.gameObject.name)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public override void Init()
        {
            base.Init();
            animController      = GetComponent <PlayerAnimationController>();
            playerController    = GetComponent <PlayerController>();
            hitboxController    = GetComponentInChildren <HitboxController>();
            limbsController     = GetComponentInChildren <LimbsController>();
            inventoryController = GetComponent <PlayerInventoryController>();

            if (unlimitedHealth.value)
            {
                currentHealth = 9999999;
            }
        }
Exemple #19
0
    public override void Start()
    {
        base.Start();
        _health        = GetComponent <HealthSystem>();
        _boxController = GetComponentInChildren <HitboxController>();

        _states = new List <Action> {
            AppearAtAnAnchor,
            ConjureProjectile,
            LaunchProjectile,
            WatchTheBolt,
            Disappear
        };

        _facingLeft = true;
        _animation  = IdleLeft;
    }
Exemple #20
0
        public override void SetupController(TraitController controller)
        {
            base.SetupController(controller);
            var hitboxFilter = HitboxController.GenerateHitboxFilter(_hitbox, CollisionLayerFactory.AGGRO);

            _controller.gameObject.SendMessageWithFilterTo(new HitboxCheckMessage {
                DoAfter = hitboxController =>
                {
                    _hitboxController = hitboxController;
                }
            }, _controller.transform.parent.gameObject, hitboxFilter);
            if (!_hitboxController)
            {
                _hitboxController = Instantiate(_hitbox.Controller, _controller.transform.parent);
                _hitboxController.Setup(_hitbox, CollisionLayerFactory.AGGRO);
            }
            _controller.gameObject.SendMessageTo(new RegisterCollisionMessage {
                Object = _controller.gameObject
            }, _hitboxController.gameObject);
            SubscribeToMessages();
        }
Exemple #21
0
        public override void Init()
        {
            aiManager       = FindObjectOfType <AIManager>();
            limbsController = GetComponentInChildren <LimbsController>();

            animHook = GetComponentInChildren <AnimatorHookAI>();
            if (animHook == null)
            {
                animHook = GetComponentInChildren <Animator>().gameObject.AddComponent <AnimatorHookAI>();
            }

            hitboxController      = GetComponentInChildren <HitboxController>();
            aiTroopController     = GetComponent <AITroopController>();
            animController        = GetComponent <AnimationController>();
            movementController    = GetComponent <AIMovementController>();
            inventoryController   = GetComponent <AIInventoryController>();
            healthController      = GetComponent <HealthController>();
            searchController      = GetComponent <AISearchAlertController>();
            aiAlertController     = GetComponent <AIAlertController>();
            fieldOfViewController = GetComponentInChildren <FieldOfViewController>();
            notificationHandler   = GetComponentInChildren <AINotificationHandler>();
            aiStateController     = GetComponent <AIStateController>();

            UpdateTransformLayer(); //Assign Correct Layer to Game Object

            //Init Assigned Components
            limbsController.Init();
            hitboxController.Init();
            aiTroopController.Init();
            animController.Init();
            animHook.Init();
            movementController.Init();
            inventoryController.Init();
            healthController.Init();
            searchController.Init();
            aiAlertController.Init();
            fieldOfViewController.Init();
            aiStateController.Init();
            notificationHandler.Init();
        }
 void Start()
 {
     body        = GetComponent <Rigidbody2D> ();
     anim        = GetComponent <Animator> ();
     sProperties = GetComponent <SpecialProperties>();
     gravity     = body.gravityScale;
     hitbox1.gameObject.SetActive(false);
     hitboxController = hitbox1.GetComponent <HitboxController>();
     healthController = GetComponent <HealthController>();
     if (GameManager.instance.PlayerIsZero)
     {
         heatParticles = GetComponentInChildren <ParticleSystem>();
     }
     if (GameManager.instance.PlayerIsZero)
     {
         heatParticles.gameObject.SetActive(false);
     }
     if (GameManager.instance.playerIsMechaman)
     {
         mechaThrusters = GetComponentInChildren <ParticleSystem>().gameObject;
     }
 }
Exemple #23
0
    public override void Start()
    {
        base.Start();

        _teleportation        = GetComponent <Teleportation>();
        _boxController        = GetComponentInChildren <HitboxController>();
        _spiralProjectileSpam = GetComponent <SpiralProjectileSpam>();

        _states = new List <Action> {
            TeleportToAnchor,
            ConjureProjectile,
            LaunchProjectileAtPlayer,
            WatchTheBolt,
            TeleportToAnchor,
            ConjureProjectile,
            SpamMagic,
            WatchTheBolt,
        };

        _facingLeft = true;
        _animation  = IdleLeft;
    }
Exemple #24
0
    /// <summary>
    /// Should be called when a harmable target has been touched.
    /// </summary>
    /// <param name="collidingHitboxArg"></param>
    private void OnTargetTouch(HitboxController collidingHitboxArg)
    {
        // if given invalid hitbox
        if (collidingHitboxArg == null)
        {
            // DONT continue code
            return;
        }

        /// if AI targeting is required to harm the target BUT the AI is NOT currently
        /// targeting the one who was touched
        if (requireAITargetingToHarm && (collidingHitboxArg.CharMaster.transform !=
                                         _aiBrain.Target))
        {
            // DONT continue code
            return;
        }

        // harm target based on character's stats
        collidingHitboxArg.CharMaster.CharHealth.TakeDamage(_charMaster, GetRandomDamage());

        // places touch damaging on a cooldown for the appropriate amount of time
        DamageCooldown();
    }
Exemple #25
0
 void Start()
 {
     rb2D             = gameObject.GetComponent <Rigidbody2D>();
     attackController = gameObject.GetComponent <HitboxController>();
     HUDDisplay.instance.updateHPBar(currentHealth, maxHealth);
 }
    // 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}
        });
    }
Exemple #27
0
 /// <summary>
 /// Damage a hitbox based on equipped weapon.
 /// </summary>
 /// <param name="hitboxArg"></param>
 private void DamageHitboxWithEquippedWeapon(HitboxController hitboxArg, Vector3 impactPointArg)
 {
     hitboxArg.CharMaster.CharHealth.TakeDamage(_characterMasterController, GetAttackDamage(),
                                                impactPointArg);
 }
Exemple #28
0
 public void Start()
 {
     _control          = GetComponent <PlayerControl>();
     _animation        = GetComponentInChildren <SpriteSystem>();
     _hitboxController = gameObject.GetComponentInChildren <HitboxController>();
 }
 /// <summary>
 /// Called when this projectile makes contact with an enemies hitbox.
 /// </summary>
 /// <param name="enemyHitboxArg"></param>
 protected virtual void OnContactWithEnemy(HitboxController enemyHitboxArg)
 {
     // IMPL in child class
 }
Exemple #30
0
        void DestoryExistingCharacterMesh()
        {
            HitboxController hitboxController = GetComponentInChildren <HitboxController>();

            DestroyImmediate(hitboxController.gameObject);
        }
 protected virtual void _CauseADamage(HitboxController hitboxController)
 {
     hitboxController.provideDamage(damage);
 }
 public void Start()
 {
     _movement = gameObject.GetComponent<SidescrollingMovement>();
     _animation = gameObject.GetComponentInChildren<SpriteSystem>();
     _hitboxController = gameObject.GetComponentInChildren<HitboxController>();
 }