private void HeartMovementUpdate(float i_FrameTime, out Vector2 o_Direction, out bool o_PassButton)
    {
        Vector2 direction  = Vector2.zero;
        bool    passButton = false;

        // Compute direction

        {
            direction = Vector2.up;
            direction = direction.Rotate(m_RandomAngle);
        }

        // Compute pass button

        {
            tnSubbuteoController subbuteoController = self.GetComponent <tnSubbuteoController>();
            if (subbuteoController != null)
            {
                float currentChargeLevel = (float)subbuteoController.chargeLevel;
                passButton = (currentChargeLevel < m_ChargingTargetLevel);

                if (!passButton)
                {
                    SetState(State.Cooldown);
                }
            }
        }

        o_Direction  = direction;
        o_PassButton = passButton;
    }
    // MonoBehaviour's interface

    void Awake()
    {
        m_SubbuteoController = GetComponentInParent <tnSubbuteoController>();

        if (m_Slider != null)
        {
            m_Slider.minValue = 0f;
            m_Slider.maxValue = 1f;
        }
    }
    private void CooldownUpdate(float i_FrameTime, out Vector2 o_Direction, out bool o_PassButton)
    {
        Vector2 direction  = Vector2.zero;
        bool    passButton = false;

        tnSubbuteoController controller = self.GetComponent <tnSubbuteoController>();

        if (controller != null)
        {
            if (!controller.isInCooldown)
            {
                SetState(State.Idle);
            }
        }

        o_Direction  = direction;
        o_PassButton = passButton;
    }
    private void SetPlayerBehavioursEnabled(bool i_Enabled)
    {
        for (int index = 0; index < charactersCount; ++index)
        {
            GameObject character = GetCharacterByIndex(index);

            if (character == null)
            {
                continue;
            }

            tnCharacterController characterController = character.GetComponent <tnCharacterController>();
            if (characterController != null)
            {
                characterController.runSyncedUpdate = i_Enabled;
            }

            tnKick kick = character.GetComponent <tnKick>();
            if (kick != null)
            {
                kick.runSyncedUpdate = i_Enabled;
            }

            tnAttract attract = character.GetComponent <tnAttract>();
            if (attract != null)
            {
                attract.runSyncedUpdate = i_Enabled;
            }

            tnTaunt taunt = character.GetComponent <tnTaunt>();
            if (taunt != null)
            {
                taunt.runSyncedUpdate = i_Enabled;
            }

            tnSubbuteoController subbuteoController = character.GetComponent <tnSubbuteoController>();
            if (subbuteoController != null)
            {
                subbuteoController.runSyncedUpdate = i_Enabled;
            }
        }
    }
Example #5
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        if (EditorApplication.isPlaying)
        {
            tnSubbuteoController subbuteoController = target as tnSubbuteoController;

            if (subbuteoController == null)
            {
                return;
            }

            TSRigidBody2D rigidbody = subbuteoController.GetComponent <TSRigidBody2D>();
            TSVector2     velocity  = (rigidbody != null) ? rigidbody.velocity : TSVector2.zero;
            FP            speed     = velocity.magnitude;

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Speed: " + speed.ToString(2), EditorStyles.label);
        }
    }
    private void ChargingUpdate(float i_FrameTime, out Vector2 o_Direction, out bool o_PassButton)
    {
        Vector2 direction  = Vector2.zero;
        bool    passButton = false;

        // Compute direction

        {
            Vector2 target;
            ComputeTarget(out target);

            Vector2 myPosition = self.transform.position;

            Vector2 selfToTarget          = target - myPosition;
            Vector2 selfToTargetDirection = selfToTarget.normalized;

            direction = selfToTargetDirection;
        }

        // Compute pass button

        {
            tnSubbuteoController subbuteoController = self.GetComponent <tnSubbuteoController>();
            if (subbuteoController != null)
            {
                float currentChargeLevel = (float)subbuteoController.chargeLevel;
                passButton = (currentChargeLevel < m_ChargingTargetLevel);

                if (!passButton)
                {
                    SetState(State.Cooldown);
                }
            }
        }

        o_Direction  = direction;
        o_PassButton = passButton;
    }
Example #7
0
    // MonoBehaviour's INTERFACE

    void Awake()
    {
        m_SubbuteoController = GetComponentInParent <tnSubbuteoController>();
    }