Exemplo n.º 1
0
    public override IEnumerator Started(CharacterInputController c)
    {
        yield return(base.Started(c));

        Debug.Log("Trago recogido!");
        c.tieneLicor = true;
    }
Exemplo n.º 2
0
    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");
        }
    }
Exemplo n.º 3
0
    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");
            }
        }
    }
Exemplo n.º 4
0
    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;
    }
Exemplo n.º 5
0
 /// <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();
         }
     }
 }
Exemplo n.º 6
0
    // 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);
    }
Exemplo n.º 7
0
    public override IEnumerator Started(CharacterInputController c)
    {
        yield return(base.Started(c));

        Debug.Log("Droga recogida!");
        c.tieneDroga = true;
    }
Exemplo n.º 8
0
    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;
        }
    }
Exemplo n.º 9
0
    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;
    }
Exemplo n.º 10
0
    // 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);
        }
    }
Exemplo n.º 11
0
    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;
        }
    }
Exemplo n.º 12
0
    /// <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;
            }
        }
    }
Exemplo n.º 13
0
    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;
    }
Exemplo n.º 15
0
 public override void Ended(CharacterInputController c)
 {
     base.Ended(c);
     Debug.Log("Cigarros terminados!");
     c.trackManager.maxSpeed = 30f;
     c.tieneCigarros         = false;
 }
Exemplo n.º 16
0
    public override void Started(CharacterInputController c)
    {
        base.Started(c);

        m_SinceStart = 0;

        c.trackManager.modifyMultiply += MultiplyModify;
    }
Exemplo n.º 17
0
    public override IEnumerator Started(CharacterInputController c)
    {
        yield return(base.Started(c));

        Debug.Log("Cigarros recogidos!");
        c.trackManager.maxSpeed = 100f;
        c.tieneCigarros         = true;
    }
Exemplo n.º 18
0
 /// <summary>
 /// 额外生命值是否生效
 /// </summary>
 /// <param name="c"></param>
 /// <returns></returns>
 public override bool CanBeUsed(CharacterInputController c)
 {
     if (c.currentLife == c.maxLife)
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 19
0
    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;
    }
Exemplo n.º 21
0
    public override IEnumerator Started(CharacterInputController c)
    {
        yield return(base.Started(c));

        m_SinceStart = 0;

        c.trackManager.modifyMultiply += MultiplyModify;
    }
Exemplo n.º 22
0
    void Start()
    {
        Instance = this;

        characterCameraController = GameObject.Find("CM_FreeLookCam").GetComponent <CinemachineFreeLook>();

        vertInput = Input.GetAxisRaw("Vertical");
        horzInput = Input.GetAxisRaw("Horizontal");
    }
Exemplo n.º 23
0
    public override void Started(CharacterInputController c)
    {
        base.Started(c);

        ///m_SinceStart = 0;

        ///c.trackManager.modifyMultiply += MultiplyModify;
        c.recipeManager.AddIngredient(this);
    }
Exemplo n.º 24
0
 /// <summary>
 /// 消耗品使用过程中进行的操作
 /// </summary>
 /// <param name="c"></param>
 public virtual void Tick(CharacterInputController c)
 {
     m_SinceStart += Time.deltaTime;
     if (m_SinceStart >= duration)
     {
         m_Active = false;
         return;
     }
 }
Exemplo n.º 25
0
 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;
    }
Exemplo n.º 28
0
//	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);
        }
    }
Exemplo n.º 29
0
 // 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);
 }
Exemplo n.º 30
0
    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);
    }
Exemplo n.º 32
0
    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();
    }