Example #1
0
    // Updates Dr. Leben drill behaviour
    public BehaviourResult UpdateBehaviour(Agent agent)
    {
        // Checks if Dr Leben script can be detected
        if (!lebenScript && (lebenScript = agent as DrLeben) == null)
        {
            return(BehaviourResult.ERROR);
        }

        // Checks whether to rage because door is a security door or just drill normally
        if (!m_rage && lebenScript.drillingStart)
        {
            // Temporarily stops Dr Leben from moving due to navAgent so that he won't slide
            lebenScript.navAgent.updatePosition = false;
            lebenScript.navAgent.ResetPath();
            return(BehaviourResult.SUCCESS);
        }

        else if (m_rage && lebenScript.securityDrilling)
        {
            // Temporarily stops Dr Leben from moving due to navAgent so that he won't slide
            lebenScript.navAgent.updatePosition = false;
            lebenScript.navAgent.ResetPath();
            return(BehaviourResult.SUCCESS);
        }
        return(BehaviourResult.FAILURE);
    }
Example #2
0
 // Use this for initialization
 void Start()
 {
     m_eventManager = FindObjectOfType <EventManager>();
     m_lebenScript  = FindObjectOfType <DrLeben>();
     if (m_teleportLocationTransform)
     {
         m_teleportLocation = m_teleportLocationTransform.position;
     }
 }
 private void OnTriggerStay(Collider other)
 {
     // Breaks door when Dr Leben is detected drill door for some time
     if (other.tag == "DrLeben" && m_panels.Count > 0 && m_lockedDoors && !m_requireCore)
     {
         if (drillTime > 0)
         {
             drillTime -= Time.fixedDeltaTime;
         }
         else if (drillTime <= 0)
         {
             BrokenDoors = true;
             DrLeben m_lebenScript = other.GetComponent <DrLeben>();
             if (m_lebenScript && m_requireCore)
             {
                 m_lebenScript.FinishDrilling();
             }
         }
     }
 }
Example #4
0
    //// This is for adding forces to anything that a body hits
    //private void OnControllerColliderHit(ControllerColliderHit hit)
    //{
    //    Rigidbody body = hit.collider.attachedRigidbody;

    //    if (m_collisionFlags == CollisionFlags.Below)
    //        return;

    //    if (body == null || body.isKinematic)
    //        return;

    //    body.AddForceAtPosition(m_controller.velocity * 0.1f, hit.point, ForceMode.Impulse);
    //}

    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "DrLeben")
        {
            m_playerCaught = true;
            m_camera.gameObject.SetActive(false);
            m_deathCameraObject.SetActive(true);
            onDeath.Invoke();
            DrLeben enemy = other.GetComponent <DrLeben>();
            if (enemy)
            {
                enemy.triggered = true;
                Debug.Log("Leben detected");
            }
        }
        //if (other.gameObject.tag == "PropBaton")
        //{
        //    other.gameObject.SetActive(false);
        //    onBatonPickup.Invoke();
        //    //playerBaton.SetActive(true);
        //    haveBaton = true;
        //    Debug.Log("Baton picked");
        //}
    }
Example #5
0
    // Use this for initialization
    void Start()
    {
        skullIcon_01.enabled = true;
        skullIcon_02.enabled = false;
        skullIcon_03.enabled = false;

        // This uses character controller since you don't want physics to affect the character with its camera
        // which can cause nausea. From experience, rigidbody remembers the forces applied to it even when kinematic
        // therefore when turned off, it gets applied to the system.
        m_controller          = GetComponent <CharacterController>();
        m_camera              = GetComponentInChildren <Camera>();
        m_eventManager        = FindObjectOfType <EventManager>();
        m_playerCollider      = GetComponent <CapsuleCollider>();
        m_originalHeight      = m_controller.height;
        m_originalCentre      = m_controller.center;
        m_cameraStandPosition = m_camera.transform.localPosition;
        m_lebenScript         = FindObjectOfType <DrLeben>();
        if (!m_hand)
        {
            if (GetComponentInChildren <HandAnimations>())
            {
                m_hand = GetComponentInChildren <HandAnimations>().gameObject;
            }
        }

        // Set the colour of the vignette to be green for scarab attacks
        currentColour = new Color(0, 120f / 255f, 0, 0);
        //bottomVignette.color = currentColour;
        //topVignette.color = currentColour;
        //leftVignette.color = currentColour;
        //rightVignette.color = currentColour;
        boxVignette.color = currentColour;
        splatImage.color  = currentColour;

        gameFader = FindObjectOfType <GameFader>();
        cutscene  = FindObjectOfType <CutsceneCamera>();

        // mouse look initialisation
        m_charRot   = transform.localRotation;
        m_cameraRot = m_camera.transform.localRotation;

        // Run speed ratio depending on toxicity
        m_toxicityToRunRatio = (m_runSpeed - m_walkSpeed) / m_maxToxicity;

        //press_E_Text.enabled = false;
        //playerInstruction.enabled = false;
        playerInstruction.text = "";
        //requires_core_Text.enabled = false;
        coreCount = 0;
        SetCoreText();
        //activate_Airlock_Text.enabled = false;

        if (m_handWalkPosition == Vector3.zero)
        {
            m_handWalkPosition = m_hand.transform.localPosition;
        }
        if (m_handRunPosition == Vector3.zero)
        {
            m_handRunPosition = m_handWalkPosition - new Vector3(0, 0.11f, 0);
        }

        //playerBaton.SetActive(false);

        //Set Slider starting toxicity to zero
        //toxicitySlider.value = m_currentToxicity;
    }
Example #6
0
    // Use this for initialization
    void Start()
    {
        drScript = GetComponent <DrLeben>();
        if (drScript)
        {
            drScript.enabled = false;
        }
        //lebenAudio = GetComponent<AudioSource> ();

        eventManager = FindObjectOfType <EventManager>();
        navAgent     = GetComponent <NavMeshAgent>();
        player       = FindObjectOfType <Player>();
        navAgent.SetDestination(transform.position);
        animator = GetComponent <Animator>();

        // ---------------------------------------------------
        // The Drill Sequence

        // Set up the drill condition
        InitialDrill drillBehaviour = new InitialDrill();

        drillBehaviour.SetParameters(false);

        // Set up drill animation
        PlayAnimation drillAnimation = new PlayAnimation();

        drillAnimation.SetParameters(animator, "DrillSequence");

        // Set up drill sequence
        Sequence drillSequence = new Sequence();

        drillSequence.addBehaviour(drillBehaviour);
        //drillSequence.addBehaviour(seekPanel);
        drillSequence.addBehaviour(drillAnimation);

        // ---------------------------------------------------
        // The Rage Sequence

        // Set up the rage condition
        InitialDrill rageBehaviour = new InitialDrill();

        rageBehaviour.SetParameters(true);

        // Set up rage animation
        PlayAnimation rageAnimation = new PlayAnimation();

        rageAnimation.SetParameters(animator, "RageSequence");

        // Set up rage sequence
        Sequence rageSequence = new Sequence();

        rageSequence.addBehaviour(rageBehaviour);
        rageSequence.addBehaviour(rageAnimation);

        //----------------------------------------------------
        // The Investigate Sequence

        // Set up alert condition
        AlertCondition alertCondition = new AlertCondition();

        // Set up investigate sequence
        Sequence investigateSequence = new Sequence();

        investigateSequence.addBehaviour(alertCondition);
        investigateSequence.addBehaviour(m_investigateArea);



        //----------------------------------------------------
        // The Main Selector

        // Set up main selector
        Selector mainSelector = new Selector();

        mainSelector.addBehaviour(drillSequence);
        mainSelector.addBehaviour(rageSequence);
        mainSelector.addBehaviour(investigateSequence);

        // Add all sequences to the behaviour list
        m_behaviours.Add(mainSelector);

        //if (!batonReference)
        //    Debug.Log("Baton Reference not set on Dr. Leben");
    }
 // Use this for initialization
 void Start()
 {
     m_lebenScript = FindObjectOfType <DrLeben>();
 }