public void AttackPerFrame(Vector2 inputVector, Vector2 movement, IsometricCharacterRenderer isoRenderer)
 {
     if (currentAttackState == IsometricCharacterRenderer.States.none)
     {
         isoRenderer.SetDirection(movement);
     }
     if (currentAttackState > animatedAttackState)
     {
         animatedAttackState += 1;
         isoRenderer.AttackDirection(inputVector, animatedAttackState);
         attackCounter = 0;
         playerAttackHitbox.HitboxDealDamage((int)animatedAttackState - 1);
     }
     else if (currentAttackState > 0)
     {
         if (attackCounter > attackFrames[(int)currentAttackState - 1])
         {
             currentAttackState  = IsometricCharacterRenderer.States.none;
             animatedAttackState = IsometricCharacterRenderer.States.none;
             attackCounter       = 0;
         }
         else
         {
             attackCounter++;
         }
     }
 }
 void Start()
 {
     _rbody       = GetComponent <Rigidbody2D>();
     _isoRenderer = GetComponentInChildren <IsometricCharacterRenderer>();
     _isoRenderer.SetDirection(Vector2.zero);
     MoveTo(0);
 }
Beispiel #3
0
 private void Awake()
 {
     joystick    = FindObjectOfType <Joystick>();
     joybutton   = FindObjectOfType <JoyButton>();
     rbody       = GetComponent <Rigidbody2D>();
     isoRenderer = GetComponentInChildren <IsometricCharacterRenderer>();
 }
 protected void Start()
 {
     isoRenderer       = GetComponent <IsometricCharacterRenderer>();
     rbody             = GetComponent <Rigidbody2D>();
     rbody.constraints = RigidbodyConstraints2D.FreezeRotation;
     if (!GetComponentInChildren <SpriteRenderer>())
     {
         spriteRenderer = gameObject.AddComponent <SpriteRenderer>();
     }
     else
     {
         spriteRenderer = GetComponentInChildren <SpriteRenderer>();
     }
     if (canBeBaited && baitRange > 0)
     {
         CircleCollider2D baitCollider = gameObject.AddComponent <CircleCollider2D>();
         baitCollider.isTrigger = true;
         baitCollider.radius    = baitRange;
     }
     if (GetComponent <AIDestinationSetter>())
     {
         destinationSetter        = GetComponent <AIDestinationSetter>();
         destinationSetter.target = pathfindingObject.transform;
         pathfinder         = GetComponent <AIPath>();
         pathfindingEnabled = true;
     }
 }
Beispiel #5
0
 private void Awake()
 {
     isometricCharacterRenderer = GetComponentInChildren <IsometricCharacterRenderer>();
     CdButton.fillAmount        = 0;
     Time.timeScale             = 1;
     panel.SetActive(false);
 }
Beispiel #6
0
 private void Awake()
 {
     rbody         = GetComponent <Rigidbody2D>();
     playerAttackS = GetComponent <PlayerAttack>();
     playerStatus  = GetComponent <PlayerStatus>();
     isoRenderer   = GetComponentInChildren <IsometricCharacterRenderer>();
 }
 public void KeyAttack(IsometricCharacterRenderer isoRenderer)
 {
     if (Input.GetKeyDown(KeyCode.Z) && (int)currentAttackState < maxAttackState)
     {
         currentAttackState += 1;
     }
     playerAttackHitbox.UpdateAllHitboxOffset(isoRenderer.LastDirection);
 }
 private void DoSpecial(Vector2 inputVector, IsometricCharacterRenderer isoRenderer, string animatedString)
 {
     if (animatedString == "zxx")
     {
         LinearBullet spawned = Instantiate <LinearBullet>(normalRangedAttackPrefab);
         spawned.Setup(transform.position, (Vector2)transform.position + IntDirectionToVector(isoRenderer.LastDirection), 0.25f, 40);
     }
 }
Beispiel #9
0
    private void Awake()
    {
        rbody        = GetComponent <Rigidbody2D>();
        isoRenderer  = GetComponentInChildren <IsometricCharacterRenderer>();
        OwnTransform = transform;

        BoidsManager.Instance.Predators.Add(gameObject);
        movementSpeed = normalMovementSpeed;
    }
Beispiel #10
0
    private void Awake()
    {
        rbody        = GetComponent <Rigidbody2D>();
        isoRenderer  = GetComponentInChildren <IsometricCharacterRenderer>();
        OwnTransform = transform;
        BoidsManager.Instance.Boids.Add(gameObject);

        isoRenderer.AverageMaxSpeed = BoidsManager.Instance.Data.MaxVelocity;
    }
Beispiel #11
0
    private void Awake()
    {
        rbody       = GetComponent <Rigidbody2D>();
        isoRenderer = GetComponentInChildren <IsometricCharacterRenderer>();
        animator    = GetComponentInChildren <Animator>();

        lastMove = new Vector2(0f, -0.5f);
        animator.SetFloat("LastMoveX", lastMove.x);
        animator.SetFloat("LastMoveY", lastMove.y);
    }
    private void Awake()
    {
        rbody = GetComponent <Rigidbody2D>();
        //rbody = GetComponent<BoxCollider2D>();
        isoRenderer = GetComponentInChildren <IsometricCharacterRenderer>();

        // **MOVE SPLASH** // Hier Splash ich das Movement aus dem anderen Tutorial in den Code mit dem 2D Movement Animator
        forward   = Camera.main.transform.forward;
        forward.y = 0;
        forward   = Vector3.Normalize(forward);
        right     = Quaternion.Euler(new Vector3(0, 90, 0)) * forward;
    }
Beispiel #13
0
    // Start is called before the first frame update
    //void Start()
    //{
    //}

    //// Update is called once per frame
    //void Update()
    //{
    //}

    private void Start() //was awake
    {
        rbody        = GetComponent <Rigidbody2D>();
        currentSpeed = baseMovementSpeed;
        isoRenderer  = GetComponentInChildren <IsometricCharacterRenderer>();
        audio        = GetComponent <AudioSource>();

        stepTimer = stepDelay;
        PlayerHudManager phm = FindObjectOfType <InGameUIManager>().playerHudImages[playerNumber].GetComponent <PlayerHudManager>();

        dodgeCooldownImg = phm.dodgeImgCooldown;
    }
    public void AttackPerFrame2(Vector2 inputVector, Vector2 movement, IsometricCharacterRenderer isoRenderer)
    {
        int curL = currentAttackString.Length;
        int aniL = animatedAttackString.Length;
        int id;

        if (animatedAttackString == "")
        {
            isoRenderer.SetDirection(movement);
        }
        if (curL > aniL)
        {
            animatedAttackString = currentAttackString.Substring(0, aniL + 1);
            id = attackHash.getKeyIndex(animatedAttackString);
            if (id != -1)
            {
                isoRenderer.AttackDirection(inputVector, stateHash[id]);
                PlaySound(animatedAttackString.Length);
                DoSpecial(inputVector, isoRenderer, animatedAttackString);
            }
            else
            {
                resetAttackString();
            }
            attackCounter = 0;
            if (id != -1)
            {
                playerAttackHitbox.HitboxDealDamage(id);
            }
        }
        if (curL > 0)
        {
            id = attackHash.getKeyIndex(animatedAttackString);
            if (id != -1)
            {
                if (attackCounter > attackFrames[id])
                {
                    resetAttackString();
                }
                else
                {
                    attackCounter++;
                }
            }
            else
            {
                resetAttackString();
            }
        }
    }
 public void KeyAttack2(IsometricCharacterRenderer isoRenderer)
 {
     if (currentAttackString.Length < maxAttackState)
     {
         if (Input.GetKeyDown(KeyCode.Z))
         {
             currentAttackString = currentAttackString + "z";
         }
         if (Input.GetKeyDown(KeyCode.X))
         {
             currentAttackString = currentAttackString + "x";
         }
     }
     playerAttackHitbox.UpdateAllHitboxOffset(isoRenderer.LastDirection);
 }
Beispiel #16
0
    // Start is called before the first frame update
    void Awake()
    {
        isoRenderer = GetComponentInChildren <IsometricCharacterRenderer>();
        rb          = GetComponent <Rigidbody2D>();

        cc               = GetComponent <CircleCollider2D>();
        audSource        = GetComponent <AudioSource>();
        audSource.volume = 0.4f;

        facingDirections.Add(FacingDirection.UP, Vector2.up);
        facingDirections.Add(FacingDirection.UP_LEFT, Vector2.up + Vector2.left);
        facingDirections.Add(FacingDirection.LEFT, Vector2.left);
        facingDirections.Add(FacingDirection.DOWN_LEFT, Vector2.down + Vector2.left);
        facingDirections.Add(FacingDirection.DOWN, Vector2.down);
        facingDirections.Add(FacingDirection.DOWN_RIGHT, Vector2.down + Vector2.right);
        facingDirections.Add(FacingDirection.RIGHT, Vector2.right);
        facingDirections.Add(FacingDirection.UP_RIGHT, Vector2.right + Vector2.up);

        floorCollider = GameObject.FindGameObjectWithTag("Floor");
        wallCollider  = GameObject.FindGameObjectWithTag("WallCollider");

        Physics2D.IgnoreLayerCollision(floorCollider.layer, gameObject.layer);
    }
 protected virtual void Awake()
 {
     rbody       = GetComponent <Rigidbody2D>();
     isoRenderer = GetComponentInChildren <IsometricCharacterRenderer>();
 }
Beispiel #18
0
 // Start is called before the first frame update
 void Start()
 {
     rb = this.GetComponent <Rigidbody2D>();
     //circle = GetComponent<CircleCollider2D>();
     isoRenderer = GetComponentInChildren <IsometricCharacterRenderer>();
 }
 public void Initialize(IsometricCharacterRenderer isoRenderer, PlayerWeapon projectile)
 {
     this.isoRenderer          = isoRenderer;
     this.projectile           = projectile;
     this.nextPossibleShotTime = 0;
 }
Beispiel #20
0
 void Awake()
 {
     rb2D = GetComponent<Rigidbody2D>();
     isoRenderer = GetComponentInChildren<IsometricCharacterRenderer>();
 }
Beispiel #21
0
 protected virtual void Awake()
 {
     isoRenderer = GetComponentInChildren <IsometricCharacterRenderer>();
 }
 private void Awake()
 {
     photonView  = GetComponent <PhotonView>();
     rbody       = GetComponent <Rigidbody2D>();
     isoRenderer = GetComponentInChildren <IsometricCharacterRenderer>();
 }
Beispiel #23
0
 private void Awake()
 {
     seeker      = GetComponent <Seeker>();
     rbody       = GetComponent <Rigidbody2D>();
     isoRenderer = GetComponentInChildren <IsometricCharacterRenderer>();
 }
 public void Initialize(IsometricCharacterRenderer isoRenderer, Rigidbody2D rbody, float movementSpeed)
 {
     this.isoRenderer   = isoRenderer;
     this.rbody         = rbody;
     this.movementSpeed = movementSpeed;
 }
 private void Awake()
 {
     gameBoard   = transform.parent.GetComponent <GameBoard>();
     rbody       = GetComponent <Rigidbody2D>();
     isoRenderer = GetComponentInChildren <IsometricCharacterRenderer>();
 }
Beispiel #26
0
 private void Awake()
 {
     rbody       = GetComponent <Rigidbody2D>();
     destination = rbody.position;
     isoRenderer = GetComponentInChildren <IsometricCharacterRenderer>();
 }