private void Awake()
    {
        _isControllable = true;
        m_Rigidbody2D   = GetComponent <Rigidbody2D>();

        if (OnJumpEvent == null)
        {
            OnJumpEvent = new UnityEvent();
        }

        if (OnFallEvent == null)
        {
            OnFallEvent = new UnityEvent();
        }

        if (OnLandEvent == null)
        {
            OnLandEvent = new UnityEvent();
        }

        if (OnGroundApproachingEvent == null)
        {
            OnGroundApproachingEvent = new UnityEvent();
        }

        if (OnCrouchEvent == null)
        {
            OnCrouchEvent = new BoolEvent();
        }

        if (OnClimbStartEvent == null)
        {
            OnClimbStartEvent = new ObstacleClimbEvent();
        }

        if (OnClimbEndEvent == null)
        {
            OnClimbEndEvent = new UnityEvent();
        }

        if (OnSlideStartEvent == null)
        {
            OnSlideStartEvent = new UnityEvent();
        }

        if (OnTurnAroundEvent == null)
        {
            OnTurnAroundEvent = new UnityEvent();
        }
    }
Beispiel #2
0
    private bool wasCrouching = false;  //Variable which determines if the player was crouching

    private void Awake()
    {
        rb = GetComponent <Rigidbody2D>(); //get the Rigidbody2D Component and stores it in the variable "rb"

        if (OnLandEvent == null)           //Creates a new Event if it doesn't exist
        {
            OnLandEvent = new UnityEvent();
        }

        if (OnCrouchEvent == null) //Creates a new Event if it doesn't exist
        {
            OnCrouchEvent = new BoolEvent();
        }
    }
    private void Awake()
    {
        m_Rigidbody2D = GetComponent <Rigidbody2D>();

        if (OnLandEvent == null)
        {
            OnLandEvent = new UnityEvent();
        }

        if (OnCrouchEvent == null)
        {
            OnCrouchEvent = new BoolEvent();
        }
    }
Beispiel #4
0
    private void Awake()
    {
        m_Rigidbody2D = GetComponent <Rigidbody2D>();
        wall_jump_angle.Normalize();

        if (OnLandEvent == null)
        {
            OnLandEvent = new UnityEvent();
        }

        if (OnCrouchEvent == null)
        {
            OnCrouchEvent = new BoolEvent();
        }
    }
    private void Awake()
    {
        _rigidbody  = GetComponent <Rigidbody>();
        _jumpNumber = MAX_JUMP_NUMBER;

        if (OnLandEvent == null)
        {
            OnLandEvent = new UnityEvent();
        }

        if (OnCrouchEvent == null)
        {
            OnCrouchEvent = new BoolEvent();
        }
    }
Beispiel #6
0
        private void Awake()
        {
            m_JumpVector  = new Vector2(0, m_JumpForce);
            m_Rigidbody2D = GetComponent <Rigidbody2D>();

            if (OnLandEvent == null)
            {
                OnLandEvent = new UnityEvent();
            }

            if (OnCrouchEvent == null)
            {
                OnCrouchEvent = new BoolEvent();
            }
        }
    private void Awake()
    {
        m_Rigidbody2D = GetComponent <Rigidbody2D>();

        if (OnLandEvent == null)
        {
            OnLandEvent = new UnityEvent();
        }
        Flip();
        if (OnCrouchEvent == null)
        {
            OnCrouchEvent = new BoolEvent();
        }
        gangleRads = (float)(glideangle * Math.PI / 180);
    }
Beispiel #8
0
    private void Awake()
    {
        m_Rigidbody2D = GetComponent <Rigidbody2D>();
        gunBarrel     = transform.Find("gunBarrel");

        if (OnLandEvent == null)
        {
            OnLandEvent = new UnityEvent();
        }

        if (OnCrouchEvent == null)
        {
            OnCrouchEvent = new BoolEvent();
        }
    }
    private void Awake()
    {
        m_Rigidbody2D = GetComponent <Rigidbody2D>();

        if (OnLandEvent == null)
        {
            OnLandEvent = new UnityEvent();
        }

        if (OnCrouchEvent == null)
        {
            OnCrouchEvent = new BoolEvent();
        }
        _scaleBase = transform.localScale;
    }
    private void Awake()
    {
        weapon        = GameObject.FindObjectOfType <Weapon> ();
        m_Rigidbody2D = GetComponent <Rigidbody2D>();

        if (OnLandEvent == null)
        {
            OnLandEvent = new UnityEvent();
        }

        if (OnCrouchEvent == null)
        {
            OnCrouchEvent = new BoolEvent();
        }
    }
    private void Awake()
    {
        startMoveSpeed = movement.moveSpeed;
        m_Rigidbody2D  = GetComponent <Rigidbody2D>();

        if (OnLandEvent == null)
        {
            OnLandEvent = new UnityEvent();
        }

        if (OnCrouchEvent == null)
        {
            OnCrouchEvent = new BoolEvent();
        }
    }
Beispiel #12
0
    private void Awake()
    {
        PC            = GetComponent <PlayableCharacter>();
        m_Rigidbody2D = GetComponent <Rigidbody2D>();

        if (OnLandEvent == null)
        {
            OnLandEvent = new UnityEvent();
        }

        if (OnCrouchEvent == null)
        {
            OnCrouchEvent = new BoolEvent();
        }
    }
Beispiel #13
0
    public static void StartListening(BooleanEventName eventName, UnityAction <bool> listener)
    {
        UnityEvent <bool> thisEvent = null;

        if (Instance.m_eventWithBoolDictionary.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.AddListener(listener);
        }
        else
        {
            thisEvent = new BoolEvent();
            thisEvent.AddListener(listener);
            Instance.m_eventWithBoolDictionary.Add(eventName, thisEvent);
        }
    }
    private void Awake()
    {
        gm            = FindObjectOfType <GameManager>();
        m_Rigidbody2D = GetComponent <Rigidbody2D>();

        if (OnLandEvent == null)
        {
            OnLandEvent = new UnityEvent();
        }

        if (OnCrouchEvent == null)
        {
            OnCrouchEvent = new BoolEvent();
        }
    }
    private void Awake()
    {
        m_Rigidbody2D   = GetComponent <Rigidbody2D>();
        originalGravity = m_Rigidbody2D.gravityScale;

        if (OnLandEvent == null)
        {
            OnLandEvent = new UnityEvent();
        }

        if (OnCrouchEvent == null)
        {
            OnCrouchEvent = new BoolEvent();
        }
    }
Beispiel #16
0
    private void Awake()
    {
        rigidbody2D = GetComponent <Rigidbody2D>();
        animator    = GetComponentInChildren <Animator>();

        if (OnLandEvent == null)
        {
            OnLandEvent = new UnityEvent();
        }

        if (OnCrouchEvent == null)
        {
            OnCrouchEvent = new BoolEvent();
        }
    }
Beispiel #17
0
        private void Reset()
        {
            Animal = GetComponent <MAnimal>();
            StraightSpineOffsetTransform = transform;

            MEvent RiderMountUIE = MalbersTools.GetInstance <MEvent>("Rider Mount UI");

            OnCanBeMounted = new BoolEvent();

            if (RiderMountUIE != null)
            {
                UnityEditor.Events.UnityEventTools.AddObjectPersistentListener <Transform>(OnCanBeMounted, RiderMountUIE.Invoke, transform);
                UnityEditor.Events.UnityEventTools.AddPersistentListener(OnCanBeMounted, RiderMountUIE.Invoke);
            }
        }
Beispiel #18
0
    private void Awake()
    {
        source        = GetComponent <AudioSource>();
        m_Rigidbody2D = GetComponent <Rigidbody2D>();

        if (OnLandEvent == null)
        {
            OnLandEvent = new UnityEvent();
        }

        if (OnRollEvent == null)
        {
            OnRollEvent = new BoolEvent();
        }
    }
Beispiel #19
0
    private void Awake()
    {
        AudioPlayer   = GetComponent <AudioEffects>();
        m_Rigidbody2D = GetComponent <Rigidbody2D>();

        if (OnLandEvent == null)
        {
            OnLandEvent = new UnityEvent();
        }

        if (OnCrouchEvent == null)
        {
            OnCrouchEvent = new BoolEvent();
        }
    }
Beispiel #20
0
    private void Awake()
    {
        m_Rigidbody2D = GetComponent <Rigidbody2D>();
        sprite        = GetComponent <SpriteRenderer>();
        bodyHandler   = GetComponent <BodyHandler>();
        if (OnLandEvent == null)
        {
            OnLandEvent = new UnityEvent();
        }

        if (OnCrouchEvent == null)
        {
            OnCrouchEvent = new BoolEvent();
        }
    }
    private void Awake()
    {
        m_Rigidbody2D      = GetComponent <Rigidbody2D>();
        m_normalDashSpeed += m_dashSpeed;

        if (OnLandEvent == null)
        {
            OnLandEvent = new UnityEvent();
        }

        if (OnCrouchEvent == null)
        {
            OnCrouchEvent = new BoolEvent();
        }
    }
    private void Awake()
    {
        if (OnLandEvent == null)
        {
            OnLandEvent = new UnityEvent();
        }

        if (OnCrouchEvent == null)
        {
            OnCrouchEvent = new BoolEvent();
        }

        called     = false;
        m_Grounded = true;
    }
Beispiel #23
0
    private void Awake()
    {
        playerGraphics = transform.FindChild("playergraphics");
        m_Rigidbody2D  = GetComponent <Rigidbody2D>();

        if (OnLandEvent == null)
        {
            OnLandEvent = new UnityEvent();
        }

        if (OnCrouchEvent == null)
        {
            OnCrouchEvent = new BoolEvent();
        }
    }
    private void Awake()
    {
        m_Rigidbody2D = GetComponent <Rigidbody2D>();
        previousY     = m_Rigidbody2D.position.y;

        if (OnLandEvent == null)
        {
            OnLandEvent = new UnityEvent();
        }

        if (OnCrouchEvent == null)
        {
            OnCrouchEvent = new BoolEvent();
        }
    }
    private void Awake()
    {
        m_Rigidbody2D = GetComponent <Rigidbody2D>();

        if (OnLandEvent == null)
        {
            OnLandEvent = new UnityEvent();
        }

        if (OnCrouchEvent == null)
        {
            OnCrouchEvent = new BoolEvent();
        }
        weapon = attackBox.GetComponent <SpriteRenderer>();
    }
Beispiel #26
0
    private void Awake()
    {
        m_Rigidbody2D = GetComponent <Rigidbody2D>();
        m_Graphics    = m_Graphics != null ? m_Graphics : transform;

        if (OnLandEvent == null)
        {
            OnLandEvent = new UnityEvent();
        }

        if (OnCrouchEvent == null)
        {
            OnCrouchEvent = new BoolEvent();
        }
    }
        private void Awake()
        {
            _mRigidbody = GetComponent <Rigidbody>();
            GetComponent <Collider>();

            if (onLandEvent == null)
            {
                onLandEvent = new UnityEvent();
            }

            if (onCrouchEvent == null)
            {
                onCrouchEvent = new BoolEvent();
            }
        }
Beispiel #28
0
    public static void StartListeningBool(string eventName, UnityAction <bool> listener)
    {
        BoolEvent thisBoolEvent = null;

        if (instance.BoolEventDictionary.TryGetValue(eventName, out thisBoolEvent))
        {
            thisBoolEvent.AddListener(listener);
        }
        else
        {
            thisBoolEvent = new BoolEvent();
            thisBoolEvent.AddListener(listener);
            instance.BoolEventDictionary.Add(eventName, thisBoolEvent);
        }
    }
Beispiel #29
0
    private void Awake()
    {
        m_Rigidbody2D = GetComponent <Rigidbody2D>();

        if (OnLandEvent == null)
        {
            OnLandEvent = new UnityEvent();
        }

        if (OnCrouchEvent == null)
        {
            OnCrouchEvent = new BoolEvent();
        }

        InvokeRepeating("WalkSound", 0.0f, 0.3f);
    }
    private void Awake()
    {
        PlayerPos playerPos = gameObject.GetComponent <PlayerPos>();

        m_Rigidbody2D = GetComponent <Rigidbody2D>();

        if (OnLandEvent == null)
        {
            OnLandEvent = new UnityEvent();
        }

        if (OnCrouchEvent == null)
        {
            OnCrouchEvent = new BoolEvent();
        }
    }