public void SetAnime(AnimeState anime) { if (animeState != anime) { animeState = anime; animator.SetInteger("StateNo", (int)animeState); } }
public Anime(Issue issue, String title, String description, String bannerPath, AnimeState state) { _issue = issue; _title = title; _description = description; _bannerPath = bannerPath; _state = state; }
void Update() { Vector3 playerVel = playerRb.velocity; Vector3 horizontalVel = new Vector3(playerVel.x, 0, playerVel.z); bool onGround = playerRoot.GetComponent <PlayerController3D>().onGround; if (onGround) { if (horizontalVel.magnitude < 0.01f) { aState = AnimeState.Idle; } else { aState = AnimeState.Run; } } else { aState = AnimeState.Jump; } // switch (aState) { case AnimeState.Idle: animator.SetBool("Run", false); animator.SetBool("Jump", false); Debug.Log("Idle"); break; case AnimeState.Run: animator.SetBool("Run", true); animator.SetBool("Jump", false); Debug.Log("Run"); break; case AnimeState.Jump: animator.SetBool("Run", false); animator.SetBool("Jump", true); Debug.Log("Jump"); break; } }
public override void Apply(DrugState drugState) { AnimeState state = drugState as AnimeState; state.slug.audio.pitch *= 1.1f; state.slug.blush.gameObject.SetActive(true); state.slug.blush.transform.localScale = new Vector2(1 + state.strength / 100f, 1 + state.strength / 10f); if (state.originalEyes == null) { state.originalEyes = state.slug.eyes.sprite; state.slug.eyes.sprite = eyesSprite; } if (state.originalMouth == null) { state.originalMouth = state.slug.mouth.sprite; state.slug.mouth.sprite = mouthSprite; DrugState testosterone = state.slug.drugs.Where(d => d.drug.GetType().Name == "Testosterone").FirstOrDefault(); state.slug.mouth.sprite = testosterone == null ? mouthSprite : (testosterone.drug as Testosterone).frown; } }
public override void FixedUpdate(float delta) { if (prefab != null) { prefab.transform.rotation = new Quaternion(0, ((MonsterSyncData)latest).yRot, 0, ((MonsterSyncData)latest).wRot); AnimeState state = (AnimeState)((MonsterSyncData)latest).anime; if (state == AnimeState.Idle) { SetIdleAnime(); } else if (state == AnimeState.Walk) { SetWalkAnime(); } else if (state == AnimeState.Attack) { SetAttackAnime(); } } }
public override void FixedUpdate(float delta) { if (prefab != null && !isPlayer) { Vector3 latestPos = new Vector3(((HeroSyncData)latest).xPos, prefab.transform.position.y, ((HeroSyncData)latest).zPos); prefab.transform.position = Vector3.Lerp(prefab.transform.position, latestPos, delta * 10.0f); prefab.transform.rotation = new Quaternion(0, ((HeroSyncData)latest).yRot, 0, ((HeroSyncData)latest).wRot); AnimeState state = (AnimeState)((HeroSyncData)latest).anime; if (state == AnimeState.Idle) { SetIdleAnime(); } else if (state == AnimeState.Walk) { SetWalkAnime(); } else if (state == AnimeState.Attack) { SetAttackAnime(); } } }
public override void Overnight(DrugState drugState) { AnimeState state = drugState as AnimeState; state.overnightChange = false; if (state.strength >= 5) { if (!state.slug.wings.gameObject.activeSelf) { state.overnightChange = true; } state.slug.wings.gameObject.SetActive(true); } else if (state.strength == 0) { state.slug.wings.gameObject.SetActive(false); state.slug.blush.gameObject.SetActive(false); state.slug.eyes.sprite = state.originalEyes; state.slug.mouth.sprite = state.originalMouth; } state.slug.audio.pitch = Mathf.Pow(1.1f, state.strength); state.slug.blush.transform.localScale = new Vector2(1 + state.strength / 100f, 1 + state.strength / 10f); }
void Awake() { AnimationStateMachine = GetComponent <AnimeState>(); currentState = ActorState.Idle; }
protected virtual void generateHitBox(AnimeState attack) { }
/* setAnimator: * manipulates the animator parameters to best fit the current state * Args: AnimeState state: state to transition the animator to * Returns: Nothing */ public void setAnimator(AnimeState state) { // switch case here for the states; call the methods below switch (state) { case AnimeState.IDLE: anime.SetBool("IsGrounded", true); anime.SetTrigger("TouchGround"); break; case AnimeState.InAir: anime.SetBool("IsGrounded", false); break; case AnimeState.IsHurt: anime.SetBool("IsHurt", true); break; case AnimeState.ExitHurt: anime.SetBool("IsHurt", false); break; case AnimeState.Dead: anime.SetTrigger("Dead"); break; case AnimeState.Jab: setJab(); break; case AnimeState.FTilt: setFTilt(); break; case AnimeState.UpTilt: setUpTilt(); break; case AnimeState.DownTilt: setDownTilt(); break; case AnimeState.NAir: setNair(); break; case AnimeState.FAir: setFair(); break; case AnimeState.BackAir: setBair(); break; case AnimeState.UpAir: setUpair(); break; case AnimeState.DownAir: setDownair(); break; case AnimeState.NeutralB: setNeutralB(); break; case AnimeState.SideB: setSideB(); break; case AnimeState.UpB: setUpB(); break; case AnimeState.DownB: setDownB(); break; case AnimeState.ReleaseJab: releaseJab(); break; case AnimeState.ReleaseNeutralB: releaseNeutralB(); break; case AnimeState.ReleaseSideB: releaseSideB(); break; case AnimeState.ReleaseUpB: releaseUpB(); break; case AnimeState.ReleaseDownB: releaseDownB(); break; } }
protected override void generateHitBox(AnimeState attack) { Collider2D[] colliders = { }; float damage = 0f; Vector2 hitDirection = new Vector2(0, 0); bool hasUniformKnockback = false; bool reflect = false; Vector3 hitLocation = new Vector3(0, 0, 0); // positive x values for away and negative for inwards // positive y values for up and negative values for down if (attack == AnimeState.Jab) { damage = 1.2f; hitDirection.x = 1.5f; hitDirection.y = 0.9f; hasUniformKnockback = true; hitLocation = new Vector2(transform.position.x + 0.7f * transform.right.x, transform.position.y); //Vector3 v = transform.TransformPoint(0.7f, -0.15f, transform.position.z); colliders = Physics2D.OverlapBoxAll( (Vector2)hitLocation, new Vector2(0.5f, 0.5f), 0, enemies); } else if (attack == AnimeState.FTilt) { damage = 7f; hitDirection.x = 6f; hitDirection.y = 1.5f; hitLocation = new Vector2(transform.position.x + 0.8f * transform.right.x, transform.position.y + 0.1f); colliders = Physics2D.OverlapBoxAll( (Vector2)hitLocation, new Vector2(1, 0.9f), 0, enemies); } else if (attack == AnimeState.UpTilt) { damage = 4f; hitDirection.x = -0.5f; hitDirection.y = 5f; hitLocation = new Vector2(transform.position.x, transform.position.y + 0.5f); colliders = Physics2D.OverlapBoxAll( (Vector2)hitLocation, new Vector2(2.3f, 1), 0, enemies); } else if (attack == AnimeState.DownTilt) { damage = 5f; hitDirection.x = 0.5f; hitDirection.y = 10f; hitLocation = new Vector2(transform.position.x + 0.8f * transform.right.x, transform.position.y - 0.5f); colliders = Physics2D.OverlapBoxAll( (Vector2)hitLocation, new Vector2(0.9f, 0.4f), 0, enemies); } else if (attack == AnimeState.NAir) { damage = 3f; hitDirection.x = 3f; hitDirection.y = 3f; hitLocation = transform.position; colliders = Physics2D.OverlapCircleAll(new Vector2(transform.position.x, transform.position.y), 0.72f, enemies); } else if (attack == AnimeState.FAir) { damage = 6.6f; hitDirection.x = 0.7f; hitDirection.y = -20f; hitLocation = new Vector2(transform.position.x + transform.right.x * 0.3f, transform.position.y + 0.4f); colliders = Physics2D.OverlapCircleAll( (Vector2)hitLocation, 0.6f, enemies); } else if (attack == AnimeState.BackAir) { damage = 0f; hitDirection.x = 8f; hitDirection.y = 1f; Vector3 t = transform.TransformPoint(-0.025f, -0.6f, transform.position.z); hitLocation = new Vector2(t.x, t.y); colliders = Physics2D.OverlapBoxAll((Vector2)hitLocation, transform.TransformVector(0.9f, 0.7f, 1f), 0, enemies); } else if (attack == AnimeState.UpAir) { damage = 3.2f; hitDirection.x = 1f; hitDirection.y = 5f; Vector3 t = transform.TransformPoint(0f, 0.9f, transform.position.z); hitLocation = new Vector2(t.x, t.y); colliders = Physics2D.OverlapBoxAll((Vector2)hitLocation, transform.TransformVector(0.5f, 1.2f, 1f), 0, enemies); } else if (attack == AnimeState.DownAir) { damage = 9f; hitDirection.x = 5f; hitDirection.y = 3f; Vector3 t = transform.TransformPoint(-0.032f, 0.032f, transform.position.z); hitLocation = new Vector2(t.x, t.y); colliders = Physics2D.OverlapBoxAll((Vector2)hitLocation, new Vector2(1.188f, 1.188f), 0, enemies); } else if (attack == AnimeState.NeutralB) { } else if (attack == AnimeState.UpB) { } else if (attack == AnimeState.SideB) { damage = 4f; hitDirection.x = 6f; hitDirection.y = 1f; Vector3 t = new Vector3(transform.position.x + 1.1f * transform.right.x, transform.position.y + 0.1f, transform.position.z); hitLocation = new Vector2(t.x, t.y); colliders = Physics2D.OverlapBoxAll( (Vector2)hitLocation, new Vector2(2.2f, 0.4f), 0, enemies); } else if (attack == AnimeState.DownB) { damage = 2f; hitDirection.x = 3f; hitDirection.y = 1f; hitLocation = transform.position; colliders = Physics2D.OverlapBoxAll( new Vector2(transform.position.x - 0.035f * transform.right.x, transform.position.y + 0.05f), new Vector2(1.8f, 1.7f), 0, enemies); reflect = true; } string name; foreach (Collider2D d in colliders) { //Debug.Log(d.name); name = d.name; if (!hasCollided(name) && (string.Compare(name, hurtboxName) != 0)) { if (d.gameObject.layer == 10) { // if hit box hit another player // calculating the direction of the hit float directionX = d.transform.position.x - transform.position.x; hitDirection.x *= directionX / Mathf.Abs(directionX); // away from the player Attack attackStruct = new Attack(damage, hitDirection, hasUniformKnockback); d.GetComponentInParent <PlayerController>().takeDamage(attackStruct, hitLocation); } else if (d.gameObject.layer == 8) { // if hit box hit a bullet if (reflect && d.gameObject.tag != transform.tag) { // if we used DownB and reflected the bullet Vector2 velo = d.gameObject.GetComponent <Rigidbody2D>().velocity; velo.x = velo.x * -1 * 1.1f; // bullet gets faster when reflected d.gameObject.GetComponent <Rigidbody2D>().velocity = velo; d.gameObject.GetComponent <RectBullet>().lifeTime = 1f; d.gameObject.tag = transform.tag; } } collided.Add(name); Debug.Log(d.name + "asdfasdfasdf:" + collided[0]); } } }