示例#1
0
    private void ClearAIForMember(HumanCharacter member)
    {
        member.MyAI.ForceStopCurrentAction();
        member.MyAI.ClearDynamicGoal(0);
        member.SendCommand(CharacterCommands.ReleaseTrigger);

        if (member.UpperBodyState == HumanUpperBodyStates.Aim && Input.GetKey(KeyCode.Mouse1) &&
            member == SelectedMember && member.MyAI.ControlType == AIControlType.Player)
        {
            member.SendCommand(CharacterCommands.Aim);
        }
        else
        {
            member.SendCommand(CharacterCommands.StopAim);
        }
        member.SendCommand(CharacterCommands.Idle);
    }
示例#2
0
    public void Enter(HumanCharacter character)
    {
        if (IsLocked)
        {
            //here check if player has key
            int keyCount = GameManager.Inst.PlayerControl.SelectedPC.Inventory.CountItemsInBackpack(KeyItemID);
            if (keyCount > 0)
            {
                //play unlock key sound
                IsLocked = false;
            }
            else
            {
                //play locked door sound
                if (SoundType == ContainerSoundType.Wood)
                {
                    AudioClip clip = GameManager.Inst.SoundManager.GetClip("WoodDoorLocked");
                    DoorSound.PlayOneShot(clip, 0.6f);
                }
                else
                {
                    AudioClip clip = GameManager.Inst.SoundManager.GetClip("MetalDoorLocked");
                    DoorSound.PlayOneShot(clip, 0.6f);
                }

                return;
            }
        }

        //adjust environment for player
        if (character.MyAI.ControlType == AIControlType.Player)
        {
            Time.timeScale = 0;
            GameManager.Inst.UIManager.FadingPanel.FadeOutAndInCallBack(1, 1, 1, FadeOutCallBack);
            character.SendCommand(CharacterCommands.Idle);
        }
        else
        {
            character.transform.position = OtherPortal.SpawnPoint.position;
            character.Destination        = character.transform.position;
            character.SendCommand(CharacterCommands.Idle);
        }

        DoorSound.Play();
    }
示例#3
0
    public void UpdateBodyStatusPlayer()
    {
        HumanCharacter player        = GameManager.Inst.PlayerControl.SelectedPC;
        float          movementSpeed = player.GetComponent <CharacterController>().velocity.magnitude;

        //stamina
        if (player.CurrentStance == HumanStances.Sprint && movementSpeed > 0.1f)
        {
            //reduce stamina
            float delta = Time.deltaTime * 20 * StaminaReduceMult;
            Stamina -= delta;
            Energy  -= delta * 1f;
            if (Stamina <= 0)
            {
                player.SendCommand(CharacterCommands.StopSprint);
            }
        }
        else if (MaxCarryWeight < CarryWeight && movementSpeed > 0.1f)
        {
            float delta = Time.deltaTime * 5 * StaminaReduceMult;
            Stamina -= delta;

            Energy -= delta * 1f;
        }
        else if (player.ActionState == HumanActionStates.None && (player.UpperBodyState == HumanUpperBodyStates.None || player.UpperBodyState == HumanUpperBodyStates.Idle))
        {
            float delta = 0;
            if (movementSpeed > 0.1f)
            {
                delta    = Time.deltaTime * StaminaRestoreSpeed * 0.5f;
                Stamina += delta;
            }
            else
            {
                delta    = Time.deltaTime * StaminaRestoreSpeed;
                Stamina += delta;
            }
        }

        if (Stamina < 0)
        {
            Stamina   = 0;
            IsResting = true;
        }
        else if (Stamina > MaxStamina)
        {
            Stamina = MaxStamina;
        }

        if (IsResting && Stamina > 20)
        {
            IsResting = false;
        }

        if (Energy < 0)
        {
            Energy = 0;
        }
        else if (Energy > MaxEnergy)
        {
            Energy = MaxEnergy;
        }
    }
示例#4
0
	private void ClearAIForMember(HumanCharacter member)
	{
		member.MyAI.ForceStopCurrentAction();
		member.MyAI.ClearDynamicGoal(0);
		member.SendCommand(CharacterCommands.ReleaseTrigger);

		if(member.UpperBodyState == HumanUpperBodyStates.Aim && Input.GetKey(KeyCode.Mouse1) 
			&& member == SelectedMember && member.MyAI.ControlType == AIControlType.Player)
		{
			member.SendCommand(CharacterCommands.Aim);
		}
		else
		{
			member.SendCommand(CharacterCommands.StopAim);
		}
		member.SendCommand(CharacterCommands.Idle);
	}