Example #1
0
    void Start()
    {
        cc = GetComponent <CharacterController>();

        playerMovement = GetComponent <FpsMovement>();

        debugcontrol = DebugControl.Instance;
    }
Example #2
0
    public void Initialize(bool re_init)
    {
        if (initedBefore == false || re_init == true)
        {
            inputField = new Rect(0.0f, Screen.height * 0.5f, Screen.width * 0.1f, 20.0f);

            notificationDisplayRect = new Rect(0.0f, inputField.y + inputField.height, inputField.width, inputField.height);
            notificationlabelStyle  = new GUIStyle();
            notificationlabelStyle.normal.textColor  = Color.red;
            notificationlabelStyle.normal.background = Texture2D.blackTexture;
            //notificationlabelStyle.alignment = TextAnchor.;

            fallScript = GameObject.FindObjectOfType <FallResponse>();
            if (fallScript == null)
            {
                Debug.Log("ERROR: DebugControl has null fallScript");
            }

            movementScript = GameObject.FindObjectOfType <FpsMovement>();
            if (movementScript == null)
            {
                Debug.Log("ERROR: DebugControl has null movementScript");
            }

            levelmanagerScript = GameObject.FindObjectOfType <LevelManager>();
            if (levelmanagerScript == null)
            {
                Debug.Log("ERROR: DebugControl has null levelmanagerScript");
            }
            inventoryScript = GameObject.FindObjectOfType <Inventory>();
            if (inventoryScript == null)
            {
                Debug.Log("ERROR: DebugControl has null inventoryScript");
            }
            cursorScript = GameObject.FindObjectOfType <HideCursorScript>();
            if (cursorScript == null)
            {
                Debug.Log("ERROR: DebugControl has null cursorScript");
            }

            playerobj = GameObject.FindGameObjectWithTag("Player");
            if (playerobj == null)
            {
                Debug.Log("ERROR: DebugControl has null playerobj");
            }

            initedBefore = true;
        }
    }
Example #3
0
    public void ActivateItemEffect(int itemId, int itemIndex)
    {
        bool validIndex = false;

        if (itemIndex < 0 || itemIndex > inventory.Count)
        {
            validIndex = false;
        }

        switch (itemId)
        {
        //case 0:
        default:
            Debug.Log("nill effect");
            break;

        case 0:
            Debug.Log("Running Shoes effect");
            break;

        case 1:
            Debug.Log("grapple effect");
            GrappleScript gscript = GetComponent <GrappleScript>();
            if (!gscript.isGrappling)
            {
                gscript.FireGrapple();
            }
            else
            {
                gscript.ReleaseGrapple();
            }
            break;

        case 2:
            FpsMovement fpsMoveScript = GetComponent <FpsMovement>();
            if (!fpsMoveScript.useParachute)
            {
                if (!GetComponent <CharacterController>().isGrounded)
                {
                    fpsMoveScript.ToggleParachute(true);
                }
            }
            else
            {
                fpsMoveScript.ToggleParachute(false);
                RemoveItem(itemId);
            }
            break;

        case 3:
            Debug.Log("Toy Bell effect");
            break;

        case 4:
            Debug.Log("Sticky Noisemaker effect");
            GameObject obj     = Instantiate(Resources.Load("DecoyAlarm"), Camera.main.transform.position, new Quaternion(0, 0, 0, 0)) as GameObject;
            CTimer     escript = obj.GetComponent <CTimer>();
            escript.OnLookInteract();
            if (validIndex == false)
            {
                RemoveItem(itemId);
            }
            else
            {
                RemoveKnownItem(itemIndex);
            }

            break;

        case 5:
            Debug.Log("Remote Controll effect");
            break;
        }
    }