Esempio n. 1
0
 // Start is called before the first frame update
 void Start()
 {
     anim     = GetComponent <Animator> ();
     body     = GetComponent <Rigidbody2D> ();
     sprite   = GetComponent <SpriteRenderer> ();
     analyser = GetComponent <CollisionAnalysis>();
     color    = sprite.color;
 }
Esempio n. 2
0
    // Start is called before the first frame update
    void Start()
    {
        //Component Set up
        body       = GetComponent <Rigidbody2D>();
        analyser   = GetComponent <CollisionAnalysis>();
        controller = GetComponent <ControlManager>();
        anim       = GetComponent <CharacterAnimation>();

        //Variable set up
        body.gravityScale = gravityScale;
    }
Esempio n. 3
0
    public MovementState(GameObject gameObject)
    {
        Rigidbody2D rigidbody = gameObject.GetComponent <Rigidbody2D>();

        pos = new Vector3(rigidbody.position.x, rigidbody.position.y, 0);
        vel = new Vector3(rigidbody.velocity.x, rigidbody.velocity.y, 0);

        CollisionAnalysis collisionAnalysis = gameObject.GetComponent <CollisionAnalysis>();

        isGroundUp    = collisionAnalysis.IsGroundUp();
        isGroundDown  = collisionAnalysis.IsGroundDown();
        isGroundRight = collisionAnalysis.IsGroundRight();
        isGroundLeft  = collisionAnalysis.IsGroundLeft();
        isVentUp      = collisionAnalysis.IsVentUp();
        isVentDown    = collisionAnalysis.IsVentDown();
        isVentRight   = collisionAnalysis.IsVentRight();
        isVentLeft    = collisionAnalysis.IsVentLeft();
    }
Esempio n. 4
0
    void Awake()
    {
        syncMovementState = true;
        analyser          = GetComponent <CollisionAnalysis>();
        keyCodes          = new KeyCode[] { left, right, up, down, jump, jumpAlt, resetTime, resetTimeAlt, solidify, solidifyAlt, clear, clearAlt, shoot, shootAlt };
        inputButtons      = new InputButton[(int)Button.nrButtons];


        for (int i = 0; i < (int)Button.nrButtons; i++)
        {
            inputButtons[i] = new InputButton(keyCodes[i]);
        }

        // if this is not the player the update function will be skipped
        if (!isPlayer)
        {
            enabled = false;
        }
    }