public override IEnumerator Started(CharacterInputController c) { yield return(base.Started(c)); Debug.Log("Trago recogido!"); c.tieneLicor = true; }
public void UpgradeFellingAxe() { Tool fellingAxe = PlayerTools.GetToolByName(ToolName.FELLING_AXE); int currentTier = fellingAxe.GetCurrentTier(); if (fellingAxe.CanBeUpgraded()) { if (fellingAxe.GetDevResourceQuantityAtTier(currentTier + 1).HasInInventory()) { CharacterInputController.InitiateUpgrade(AnimState.UPGRADE_TOOL); //might need to reference actual PlayerTools object fellingAxe.SetCurrentTier(currentTier + 1); fellingAxe.GetDevResourceQuantityAtTier(currentTier + 1).SubtractFromInventory(); UpdateToolsResources(); // UpdatePlayerResources(); Debug.Log("Upgraded Felling Axe"); } else { Debug.Log("Insufficient Resources: " + fellingAxe.GetDevResourceQuantityAtTier(currentTier + 1)); } } else { Debug.Log("Max Tier Reached: FELLING AXE"); } }
void ManageIn(Collider2D other) { if (!isIn && !CharacterManager.Instance.firstRun) { if (CompareDefinition(other)) { isIn = true; spriteAngry = other.GetComponentInChildren <ChangeSpriteInAnimation>(); if (spriteAngry.isActive) { return; } AddCallbackRestorte(); character = other.GetComponent <CharacterInputController>(); move = other.GetComponent <MoveStateKlaus>(); anim = other.GetComponentInChildren <Animator>(); character.isBlock = true; character.enabled = false; move.BlockThrow = true; character.SetNoInput(); CameraFollow.Instance.ChangueTargetOnly(other.transform, (TimeToAngry + TimeToBackK1)); currentZoom = DynamicCameraManager.Instance.ZoomKlaus; DynamicCameraManager.Instance.ChangueZoomToKlaus(ZoomForKlaus, TimeToAngry * PercentTimeToZoomKlaus); anim.SetBool("Angry", true); if (sfx1 != null && sfx2 != null) { sfx1.Play(); sfx2.Play(); } StartCoroutine("AngryControllerActive"); } } }
void Awake() { anim = GetComponent <Animator>(); if (anim == null) { Debug.Log("Animator could not be found"); } rb = GetComponent <Rigidbody>(); if (rb == null) { Debug.Log("Rigid body could not be found"); } cinput = GetComponent <CharacterInputController>(); if (cinput == null) { Debug.Log("CharacterInputController could not be found"); } GameManager.Instance.player = gameObject; }
/// <summary> /// 消耗品使用结束后进行的操作 /// </summary> /// <param name="c"></param> public virtual void Ended(CharacterInputController c) { if (m_ParticleSpawned != null) { if (activatedParticle.main.loop) { Destroy(m_ParticleSpawned.gameObject); } } //处理特效播放的声音 if (activatedSound != null && c.powerupSource.clip == activatedSound) { c.powerupSource.Stop();//如果输入的特效声音是正在播放的那一个特效声音则停止播放 } // for (int i = 0; i < c.consumables.Count; ++i) { //如果一个特效声音在播放着,输入另一个特效声音,则还是会播放原来的特效声音 if (c.consumables[i].active && c.consumables[i].activatedSound != null) { c.powerupSource.clip = c.consumables[i].activatedSound; c.powerupSource.Play(); } } }
// publično prepisivanje metode za vračanje specifirane kao "Tick" public override void Tick(CharacterInputController c) { // kod specifirane baze koja je prepisana zbog druge metode base.Tick(c); c.characterCollider.SetInvincibleExplicit(true); }
public override IEnumerator Started(CharacterInputController c) { yield return(base.Started(c)); Debug.Log("Droga recogida!"); c.tieneDroga = true; }
protected override void Start() { base.Start(); cdGrid = GetComponentsInChildren <UICD>(); skillSprite = new UISprite[cdGrid.Length]; cdTime = new float[cdGrid.Length]; nowTime = new float[cdGrid.Length]; player = GameObject.FindGameObjectWithTag("Player"); chSkill = player.GetComponent <CharacterSkillManager>(); chInput = player.GetComponent <CharacterInputController>(); for (int i = 0; i < cdGrid.Length; i++) { UISceneWidget mButton_Skill = cdGrid[i].GetComponent <UISceneWidget>(); if (mButton_Skill != null) { mButton_Skill.OnMouseClick = this.ButtonSkillOnClick; } cdGrid[i].InitWidgets(); cdGrid[i].index = i; cdGrid[i].SetIcon(SkillManager.Instance.mSkillInfo[i].skillIcon); GetSkillCD(SkillManager.Instance.mSkillInfo[i].id, out cd, out mp); cdGrid[i].GetComponent <UISceneWidget>().Throughtime = cd; cdTime[i] = nowTime[i] = cd; skillSprite[i] = cdGrid[i].mSprite_CD; cdGrid[i].costSp = mp; } mButton_Attack = GetWidget("BaseSkill"); if (mButton_Attack != null) { mButton_Attack.OnMousePress = this.ButtonAttackOnPress; } }
void SnapPlayer() { CharacterMotor.SetCanMove(false); CharacterInputController.SetCanTurn(false); CharacterInputController.ToggleToolsInput(false); canPerformAction = true; switch (currentActivity) { case LoggingActivity.FELLING: CharacterInputController.InitiateLoggingState(AnimState.IDLE_FELLING); break; case LoggingActivity.BUCKING: CharacterInputController.InitiateLoggingState(AnimState.IDLE_BUCKING); break; case LoggingActivity.SPLITTING: CharacterInputController.InitiateLoggingState(AnimState.IDLE_SPLITTING); break; } transform.position = snapLocation.position; transform.rotation = snapLocation.rotation; GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeAll; playerIsLocked = true; }
// Use this for initialization protected override void AwakeChild() { GameObject[] allP = GameObject.FindGameObjectsWithTag("Player"); charsInput = new CharacterInputController[allP.Length]; moveStateChars = new MoveState[charsInput.Length]; arrows = new GameObject[allP.Length]; for (int i = 0; i < allP.Length; ++i) { charsInput[i] = allP[i].GetComponent <CharacterInputController>(); charsInput[i].enabled = false; charsInput[i].gameObject.GetComponent <AudioListener>().enabled = false; moveStateChars[i] = allP[i].GetComponent <MoveState>(); arrows[i] = Arrow.Spawn().gameObject; arrows[i].transform.parent = charsInput[i].transform; arrows[i].SetActive(false); } currentSelected = 0; canMove = new bool[charsInput.Length]; for (int i = 0; i < canMove.Length; ++i) { SetCanMove(i, true); } }
public virtual IEnumerator Started(CharacterInputController c) { m_SinceStart = 0; if (activatedSound != null) { c.powerupSource.clip = activatedSound; c.powerupSource.Play(); } if (ActivatedParticleReference != null) { //Addressables 1.0.1-preview var op = ActivatedParticleReference.InstantiateAsync(); yield return(op); m_ParticleSpawned = op.Result.GetComponent <ParticleSystem>(); if (!m_ParticleSpawned.main.loop) { StartCoroutine(TimedRelease(m_ParticleSpawned.gameObject, m_ParticleSpawned.main.duration)); } m_ParticleSpawned.transform.SetParent(c.characterCollider.transform); m_ParticleSpawned.transform.localPosition = op.Result.transform.position; } }
/// <summary> /// Set if character can be controlled /// </summary> /// <param name="value"></param> /// <param name="inputChar"></param> public void SetPlay(bool value, CharacterInputController inputChar) { for (int i = 0; i < charsInput.Length; ++i) { if (charsInput[i] == inputChar) { SetCanMove(i, value); if (!value) { if (isAllSelected) { NoneSelected(); } if (currentSelected == i) { SelectUpdate(); } } break; } } }
void InitIfNeeded() { if (!_characterModel) { _characterModel = GetComponentInChildren <CharacterModel>(); } if (!_characterHealthController) { _characterHealthController = GetComponentInChildren <CharacterHealthController>(); _characterHealthController.onHealthChanged += (float oldHealth, float health) => { if (health < oldHealth) { if (isChargingSpirit) { CancelSpiritCharge(); } } }; } if (!_characterInputController) { _characterInputController = GetComponentInChildren <CharacterInputController>(); } if (!_characterMovementController) { _characterMovementController = GetComponentInChildren <CharacterMovementController>(); } }
void Awake() { anim = GetComponent <Animator>(); if (anim == null) { Debug.Log("Animator could not be found"); } rbody = GetComponent <Rigidbody>(); if (rbody == null) { Debug.Log("Rigid body could not be found"); } cinput = GetComponent <CharacterInputController>(); if (cinput == null) { Debug.Log("CharacterInputController could not be found"); } anim.applyRootMotion = true; }
public override void Ended(CharacterInputController c) { base.Ended(c); Debug.Log("Cigarros terminados!"); c.trackManager.maxSpeed = 30f; c.tieneCigarros = false; }
public override void Started(CharacterInputController c) { base.Started(c); m_SinceStart = 0; c.trackManager.modifyMultiply += MultiplyModify; }
public override IEnumerator Started(CharacterInputController c) { yield return(base.Started(c)); Debug.Log("Cigarros recogidos!"); c.trackManager.maxSpeed = 100f; c.tieneCigarros = true; }
/// <summary> /// 额外生命值是否生效 /// </summary> /// <param name="c"></param> /// <returns></returns> public override bool CanBeUsed(CharacterInputController c) { if (c.currentLife == c.maxLife) { return(false); } return(true); }
void Start() { follower = GameObject.FindWithTag("Player").GetComponent <CharacterInputController>(); follow = GameObject.FindWithTag("camera").transform; lookDir = follow.forward; curLookDir = follow.forward; }
public override void OnDestroy() { _camera = null; _inputer = null; _motioner = null; }
public override IEnumerator Started(CharacterInputController c) { yield return(base.Started(c)); m_SinceStart = 0; c.trackManager.modifyMultiply += MultiplyModify; }
void Start() { Instance = this; characterCameraController = GameObject.Find("CM_FreeLookCam").GetComponent <CinemachineFreeLook>(); vertInput = Input.GetAxisRaw("Vertical"); horzInput = Input.GetAxisRaw("Horizontal"); }
public override void Started(CharacterInputController c) { base.Started(c); ///m_SinceStart = 0; ///c.trackManager.modifyMultiply += MultiplyModify; c.recipeManager.AddIngredient(this); }
/// <summary> /// 消耗品使用过程中进行的操作 /// </summary> /// <param name="c"></param> public virtual void Tick(CharacterInputController c) { m_SinceStart += Time.deltaTime; if (m_SinceStart >= duration) { m_Active = false; return; } }
public virtual void Tick(CharacterInputController c) { // By default do nothing, override to do per frame manipulation m_SinceStart += Time.deltaTime; if (m_SinceStart >= duration) { m_Active = false; return; } }
public override void UnInit() { _motioner = null; _montionAttr = null; _inputer = null; _camera = null; }
public override void Init(object parameters) { base.Init(parameters); _inputer = CharacterInputController.Instance; _motioner = this.stateMachine.motionController; _camera = _motioner.cameraController; }
// private enum Actions { // Jump, // Attack, // Grab, // Block, // Explode, // Fly, // } public CharacterInputController() { instance = this; actionsList = System.Enum.GetNames(typeof(byteActions)); foreach (string item in actionsList) { states.Add(item, false); } }
// publično prepisivanje booleana(0 ili 1) specificiranog u kodu public override bool CanBeUsed(CharacterInputController c) { //Sekcija koda koja uglavnom sljedi bool class koja određuje koja se akcija odvija ako upisani parametar je lažan ili točan if (c.currentLife == c.maxLife) { //vrati valutu specifiranu u kodu return(false); } //vrati valutu specifiranu u kodu return(true); }
public void ImmediatelyCloseMenu() { CharacterInputController.ToggleCharacterInput(true); CharacterInputController.ToggleCameraInput(true); menuObject.transform.localPosition = closedPosition; moveTime = 0f; menuOpen = false; doMove = false; }
public override void Start () { //animationTarget.Play("Default_Idle"); input = GetComponent<CharacterInputController>(); base.Start(); MakeSpawnPool(); myAnimation["Default_Idle"].layer = 0; myAnimation["Default_Run"].layer = 0; myAnimation["Default_Death"].layer = 7; //myPhotonView.RPC("CrossFadeAnimation", PhotonTargets.All, "Default_Idle"); //Debug.LogWarning("FADING IDLE"); //CrossfadeAnimation("Default_Idle", false); }
public void LoadAvatar() { //SUPER HACK if(NetworkManager.Instance.offlineMode || GameManager.Instance.teststate && !GameManager.Instance.newGame) StartNewGame(); avatarObject = PhotonNetwork.Instantiate("PlayerAvatar", SpawnPoint.position , Quaternion.identity, 0) as GameObject; //avatarObject = GameObject.Instantiate(Resources.Load("PlayerAvatar"), SpawnPoint.position, Quaternion.identity) as GameObject; //avatarObject.AddComponent<DontDestroy>(); avatarStatus = avatarObject.GetComponent<PlayerCharacter>(); avatarInput = avatarObject.GetComponent<CharacterInputController>(); avatarActionManager = avatarObject.GetComponent<CharacterActionManager>(); //PlayerMotor cm = avatarObject.GetComponent<PlayerMotor>(); //cm.enabled = true; //avatarInput.enabled = true; avatarNetworkMovement = avatarObject.GetComponent<NetworkCharacterMovement>(); //UICamera.fallThrough = avatarObject; avatar = avatarObject.GetComponent<Avatar>(); avatarPhotonView = avatarObject.GetComponent<PhotonView>(); Invoke("RefreshAvatar", 0.1f); //PlayerCamera.Instance.targetTransform = avatarObject.transform; //LoadCharacterParts(); }