Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        rb2d           = GetComponent <Rigidbody2D>();
        actionSystem   = GetComponent <PlayerActionSystem>();
        playerAnimator = GetComponent <PlayerAnimator>();

        // Calculate static values of forces here instead of FixedUpdate() so we
        // only calculate them once, as they never change. For optimsation.
        inAirMoveForce     = moveForce * 0.5f;
        whileAttkMoveForce = moveForce * 0.4f;
        slowdownForce      = moveForce;

        preBuffMaxSpeed   = maxSpeed;
        maxSpeedInAir     = maxSpeed * 0.7f;
        maxSpeedWhileAttk = maxSpeed * 0.5f;

        // Calculate the static vectors here instead of FixedUpdate() so we only
        // calculate them once, as they never change. For optimisation.
        bounceEnemyLeftV  = new Vector2(1, 0.5f) * throwbackForce;
        bounceEnemyRightV = new Vector2(-1, 0.5f) * throwbackForce;
        slowdownLeft      = Vector2.left * slowdownForce;
        slowdownRightV    = Vector2.right * slowdownForce;
        moveLeftV         = Vector2.left * moveForce;
        moveRightV        = Vector2.right * moveForce;
        jumpV             = new Vector2(0f, jumpForce);

        // Abilities
        actionSystem.Setup(moveLeftV, moveRightV);
    }
Exemplo n.º 2
0
    void Awake()
    {
        objectiveHealth = GetComponent <ObjectiveHealthSystem>();
        playerHealth    = GetComponent <PlayerHealthSystem>();
        stateSystem     = GetComponent <StateSystem>();
        waveSystem      = GetComponent <WaveSystem>();

        playerAction = player1.GetComponent <PlayerActionSystem>();

        enemies    = new List <GameObject>();
        deadBodies = new List <GameObject>();
    }