public void OnTriggerStay2D(Collider2D other) { if (!ignore) { CharController_RPG_Framework controller = other.gameObject.GetComponent <CharController_RPG_Framework>(); if (controller.isOnGrid) { startTransition = true; } } }
// Use this for initialization void Start() { RefreshStepsToNextBattle(); if (battleScenes.Length == 0) { Debug.LogWarning("This scene contains no battle scenes. If it is not supposed to have battles, the RandomBattleController component should be disabled or removed. If it should have random battles, you must add at least one battle scene."); this.enabled = false; return; } walkingCharacter = GameObject.FindGameObjectWithTag("Player").GetComponent <CharController_RPG_Framework>(); lastKnownPlayerPosition = walkingCharacter.gridPosition; }
public void DoAnimation(CharController_RPG_Framework controler) { //animate and move if moving if (controler.isMoving && animationSpeed != 0) { animationFrame += animationSpeed; if (animationFrame >= maxAnimationFrame) { animationFrame = 1; } } else if (animationSpeed == 0) { animationFrame = 0; } else { animationFrame = 0; } //update sprite switch (controler.moveDirection) { case StaticData.DIR_UP: sr.sprite = upSprites[Mathf.FloorToInt(animationFrame)]; break; case StaticData.DIR_LEFT: sr.sprite = leftSprites[Mathf.FloorToInt(animationFrame)]; break; case StaticData.DIR_RIGHT: sr.sprite = rightSprites[Mathf.FloorToInt(animationFrame)]; break; case StaticData.DIR_DOWN: sr.sprite = downSprites[Mathf.FloorToInt(animationFrame)]; break; } }
public void RegisterPlayerController(CharController_RPG_Framework curController) { //this simply overrides the previous registered controller playerController = curController; }