public virtual void OnStart()
    {
        gameObject.mLayerMask.AddLayer(LayerMask.Layers.LAYER_NORAYCAST);

        // Disable Collision trigger stuff
        triggerPhysics = gameObject.RequireComponent<CPhysics>();
        triggerPhysics.mColliderType = 0; // static
        triggerPhysics.mIsTriggered = true; // Disable collision response

        // Disable CMeshRenderer
        triggerMesh = gameObject.RequireComponent<CMeshRenderer>();
        triggerMesh.setEnabled(false);
    }
    public void OnStart()
    {
        if (gameObject.transform.GetParent() != null)
        {
            gameObject.transform.SetParent(null);
        }

        speedX = 0;
        speedZ = 0;
        currSpeed = speedNormal;
        speedWhenJumped = 0.0f;

        canJump = true;

        // playerBox is actually my own gameObject
        playerBox = gameObject; // GameObject.GetGameObjectByName("PlayerBoxCollider");
        playerBoxMesh = playerBox.RequireComponent<CMeshRenderer>();
        playerBoxMesh.setEnabled(false);
        playerCamera = Common.GetStealthPlayerCamera();
        playerCamScript = GetScript<FirstPersonCamera>(playerCamera);
        player = Common.GetStealthPlayerMesh();
        anim = player.RequireComponent<CAnimationController>();
        anim.mIsPlaying = true;

        playerPhysics = gameObject.RequireComponent<CPhysics>();
        playerPhysics.mColliderType = 1;

        idle = new State(smc, State_Idle_Enter, State_Idle_Update, State_Idle_Exit);
        move = new State(smc, State_Move_Enter, State_Move_Update, State_Move_Exit);
        jump = new State(smc, State_Jump_Enter, State_Jump_Update, State_Jump_Exit);
        crouch = new State(smc, State_Crouch_Enter, State_Crouch_Update, State_Crouch_Exit);

        sprinting = new State(smc, State_Sprinting_Enter, State_Sprinting_Update, State_Sprinting_Exit, 0.5f);
        sprinting.NextState = sprinting;
        notsprinting = new State(smc, State_NotSprinting_Enter, State_NotSprinting_Update, State_NotSprinting_Exit);

        smc.SetState(idle);
        sprint_smc.SetState(notsprinting);

        footstepID = GetSoundComponent().GetUniqueEvent("P1_FOOTSTEPS.vente", 0);
    }
예제 #3
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CPhysics obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
예제 #4
0
    public void OnStart()
    {
        player = Common.GetStealthPlayer();

        doorPhysics = gameObject.RequireComponent<CPhysics>();
        mSound = gameObject.RequireComponent<CSound>();

        if (isSingleDoor)
        {
            ruDoor = gameObject;
        }
        else
        {
            uint numChildren = gameObject.transform.GetNumberOfChildren();
            if (numChildren >= 2)
            {
                for (uint i = 0; i < numChildren; ++i)
                {
                    GameObject currChild = gameObject.transform.GetChild(i).gameObject;
                    String name = currChild.GetName();
                    if (ldDoor == null && name == Common.nameForLeftDoor)
                    {
                        ldDoor = currChild;
                    }
                    else if (ruDoor == null && name == Common.nameForRightDoor)
                    {
                        ruDoor = currChild;
                    }
                }
            }
        }

        isOpen = false;
        //openDir = 3;//OPENING_DIRECTION.OPEN_LEFT;
        initPos = gameObject.transform.position;
        targetPosVal = 0.0f;
        currTime = 0.0f;
        if (timeToFullyOpen == 0.0f)
            timeToFullyOpen = 1.0f;
        normalDir = gameObject.transform.GetForwardVector();
        sideDir = gameObject.transform.GetRightVector();
        upDir = gameObject.transform.GetUpVector();
        if (ruDoor != null)
        {
            ruInitPos = ruDoor.transform.position;
            if (ldDoor != null)
                ldInitPos = ldDoor.transform.position;

            // normalDir = ruDoor.transform.GetForwardVector();
            // sideDir = ruDoor.transform.GetRightVector();
            // upDir = ruDoor.transform.GetUpVector();
        }
        currNormalDist = 0.0f;
        isNormalFrontPositive = 0;
        if (distToCloseForPlayer <= 0.0f) // if set to 0 or negative, default to open distance
        {
            distToCloseForPlayer = distToOpenForPlayer;
        }
    }
    public void OnStart()
    {
        oldPos = gameObject.transform.position;

        playerPhysics = gameObject.RequireComponent<CPhysics>();
    }
예제 #6
0
    /*
    public enum OPENING_DIRECTION
    {
        OPEN_LEFT = 0,
        OPEN_RIGHT,
        OPEN_UP,
        OPEN_DOWN,

        NUM_OPENING_DIRECTIONS
    };
    */
    public void OnStart()
    {
        player = Common.GetStealthPlayer();

        doorPhysics = gameObject.RequireComponent<CPhysics>();
        mSound = gameObject.RequireComponent<CSound>();

        isOpen = false;
        //openDir = 3;//OPENING_DIRECTION.OPEN_LEFT;
        initPos = gameObject.transform.position;
        targetPosVal = 0.0f;
        currTime = 0.0f;
        if (timeToFullyOpen == 0.0f)
            timeToFullyOpen = 1.0f;
        normalDir = gameObject.transform.GetForwardVector();
        sideDir = gameObject.transform.GetRightVector();
        currNormalDist = 0.0f;
        isNormalFrontPositive = 0;
    }
예제 #7
0
 public void OnStart()
 {
     Camcphy = gameObject.RequireComponent<CPhysics>();
     bcc     = gameObject.RequireComponent<CMeshColliderComponent>();
     //Camcphy.mIsDynamic = true;
 }
    public void OnStart()
    {
        ocuMouse = GetScript<OcuMouse>(Common.GetSurveillancePlayerMouse() );
        player = Common.GetStealthPlayer();
        playerScript = GetScript<FirstPersonPlayer>(player);
        camera = Common.GetStealthPlayerCamera();
        cameraCam = Common.GetSurveillancePlayerStaticCameraCam();
        camScript = GetScript<CameraCam>(cameraCam);
        camRotLimitScript = GetScript<CameraRotationLimit>(gameObject);

        heldObjectPosition = GameObject.GetGameObjectByName("HeldObjectPosition");

        sound = gameObject.RequireComponent<CSound>();
        flyingSoundID = sound.GetUniqueEvent("CAM_FLIGHT.vente", 2);

        camPhysics = gameObject.RequireComponent<CPhysics>();
        camPhysics.mColliderType = 1;
        camMesh = gameObject.RequireComponent<CMeshRenderer>();
        mInitialScale = (Vector3)gameObject.transform.GetScale();

        nonActive = new State(smc, State_NonActive_Enter, State_NonActive_Update, State_NonActive_Exit);
        flyingTowardsWall = new State(smc, State_FlyTowardsWall_Enter, State_FlyTowardsWall_Update, State_FlyTowardsWall_Exit);
        activeOnWall = new State(smc, State_ActiveOnWall_Enter, State_ActiveOnWall_Update, State_ActiveOnWall_Exit);
        flyingBackToPlayer = new State(smc, State_FlyingBackToPlayer_Enter, State_FlyingBackToPlayer_Update, State_FlyingBackToPlayer_Exit);

        smc.SetState(nonActive); // Initial state
    }
예제 #9
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CPhysics obj)
 {
     return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
 }
예제 #10
0
    void InitCar()
    {
        foundCar = true;
        carPhysics = rcCar.RequireComponent<CPhysics>();
        carPhysics.mColliderType = 1;

        currYRotation = rcCar.transform.GetRotation().y;

        rcCarRigidCom = carPhysics.rigidCom;
    }