Exemplo n.º 1
0
    public override void Interract(Tool.ToolType heldTool, float deltaTime)
    {
        if (Tutorial)
        {
        }
        if (heldTool == Tool.ToolType.Wrench)
        {
            health += repairSpeed * Time.deltaTime;

            if (health > 200f)
            {
                Working = true;
                health  = 200f;
                healthBar.GetComponent <SpriteRenderer>().color = Color.green;
            }

            Vector2 scale = healthBar.transform.localScale;
            scale.x = health / 100;
            healthBar.transform.localScale = scale;
        }
        else if (heldTool == Tool.ToolType.FireExtinguisher)
        {
            fireState -= exstinguishSpeed * Time.deltaTime;

            if (fireState < 0f)
            {
                fireState = 0f;
                OnFire    = false;
                Fire.SetActive(false);
            }
        }
    }
Exemplo n.º 2
0
 private void OnToolPickedUpTutorial(Tool.ToolType type, int playerNum)
 {
     if (type == ToolType.BUCKET)
     {
         bucketHeldTutorial = true;
     }
 }
Exemplo n.º 3
0
 private void OnToolDroppedTutorial(Tool.ToolType type, int playerNum)
 {
     if (type == ToolType.BUCKET)
     {
         bucketHeldTutorial = false;
     }
 }
Exemplo n.º 4
0
 public void OnInteractionBy(Hand hand, Tool.ToolType toolType)
 {
     if (interactDelegate != null)
     {
         interactDelegate(this, hand, toolType);
     }
 }
Exemplo n.º 5
0
 private void OnToolDropped(Tool.ToolType type, int playerNum)
 {
     if (panel_type == TutorialEventController.TutorialStates.PICK_UP_TOOL_GO_TO_PATIENT && type != Tool.ToolType.DEFIBULATOR)
     {
         RemovePlayerCircle(playerNum);
     }
 }
Exemplo n.º 6
0
 public void InformToolDropped(Tool.ToolType type, bool full)
 {
     if (type == Tool.ToolType.CANISTER)
     {
         if (onToolDroppedCanister != null)
         {
             onToolDroppedCanister(0);
         }
     }
     else if ((currentIndexInReciepe != -1) && (type == RequiredToolForReciepeState(scene1ReciepeElements[currentIndexInReciepe])))
     {
         if (onToolDroppedForSurgery != null)
         {
             onToolDroppedForSurgery(type);
         }
     }
     else if (type == Tool.ToolType.BUCKET)
     {
         onBucketDropped(full);
     }
     else
     {
         if (onToolDroppedGeneral != null)
         {
             onToolDroppedGeneral(type);
         }
     }
 }
Exemplo n.º 7
0
    private void EnteringUpdate()
    {
        var t = getT(timeLastState, timeToEnter);

        if (t >= 1.0)
        {
            current_state = StepCompletePanelState.SHOWING;
            timeLastState = Time.time;
            if (panel_type == TutorialEventController.TutorialStates.PICK_UP_TOOL_GO_TO_PATIENT)
            {
                for (int i = 0; i < TutorialEventController.Instance.playerHasTool.Length; ++i)
                {
                    Tool.ToolType type      = TutorialEventController.Instance.playerHasTool[i];
                    bool          atPatient = TutorialEventController.Instance.doctorAtPatient[i];
                    if (atPatient)
                    {
                        AddPlayerCircle(i, type, true);
                    }
                    else if (type != Tool.ToolType.NONE)
                    {
                        AddPlayerCircle(i, type, false);
                    }
                }
            }
        }
        Vector3 newPos = Mathfx.Hermite(startPos, rect3posOrig, t);

        rectTrans.position = newPos;
    }
Exemplo n.º 8
0
 private void OnToolPickedUp(Tool.ToolType type, int playerNum)
 {
     if (tutorialToopPickUp)
     {
         actionButtonCanvas.SetActive(true);
     }
 }
 public override void Interract(Tool.ToolType heldTool, float deltaTime)
 {
     if (heldTool == Tool.ToolType.FireExtinguisher)
     {
         Health += 50f * deltaTime;
     }
 }
Exemplo n.º 10
0
 private void OnInteraction(Interactable interactable, Hand hand, Tool.ToolType toolType)
 {
     if (toolType == Tool.ToolType.None)
     {
         hand.GrabObject(this);
     }
 }
Exemplo n.º 11
0
 private void OnToolPickedUp(Tool.ToolType type, int playerNum)
 {
     if (panel_type == TutorialEventController.TutorialStates.PICK_UP_TOOL_GO_TO_PATIENT && type != Tool.ToolType.DEFIBULATOR)
     {
         AddPlayerCircle(playerNum, type, false);
     }
 }
Exemplo n.º 12
0
 private void OnScalpelDroppedForSurgery(Tool.ToolType type)
 {
     if ((type == ToolType.SCALPEL) && !surgeryInitiated)
     {
         actionButtonCanvas.SetActive(true);
         actionButtonCanvas.GetComponent <BounceUpAndDown>().initiateBounce();
     }
 }
Exemplo n.º 13
0
 private void OnInteraction(Interactable interactable, Hand hand, Tool.ToolType toolType)
 {
     if (toolType == Tool.ToolType.None)
     {
         hand.toolHandler.SetTool(inHandVersionPrefab);
         Destroy(gameObject);
     }
 }
Exemplo n.º 14
0
    public void OnSoakBlood(float duration)
    {
        var go = (GameObject)Instantiate(gauzeHotspotsPrefab, hotspotSpawnPos);

        go.transform.parent        = hotspotSpawnPos;
        go.transform.localPosition = Vector3.zero;
        go.transform.localRotation = Quaternion.identity;
        requiredTool = Tool.ToolType.GAUZE;
    }
Exemplo n.º 15
0
    public void OnInteract(Interactable interactable, Hand hand, Tool.ToolType toolType)
    {
        Repairable repairable = interactable.GetComponent <Repairable>();

        if (repairable != null)
        {
            repairable.RepairWithTool(toolType);
        }
    }
Exemplo n.º 16
0
    public void OnCutPatientOpen(float duration)
    {
        var go = (GameObject)Instantiate(scalpelTrackPrefab, hotspotSpawnPos);

        go.transform.parent        = hotspotSpawnPos;
        go.transform.localPosition = Vector3.zero;
        go.transform.localRotation = Quaternion.identity;
        requiredTool = Tool.ToolType.SCALPEL;
    }
Exemplo n.º 17
0
 private void OnToolDropped(Tool.ToolType type)
 {
     if (type == ToolType.DEFIBULATOR)
     {
         if (!defibulatorUsedOnce && criticalEvent)
         {
             actionButtonCanvas.SetActive(true);
             actionButtonCanvas.GetComponent <BounceUpAndDown>().initiateBounce();
         }
     }
 }
Exemplo n.º 18
0
 private void OnInteraction(Interactable interactable, Hand hand, Tool.ToolType toolType)
 {
     if (toolType == Tool.ToolType.Wrench)
     {
         gameObject.SetActive(false);
         Transform spawned = Instantiate(toSpawn, transform.position, transform.rotation);
         spawned.localScale = transform.lossyScale;
         spawned.GetComponent <Repairable>().currentState = GetComponent <Repairable>().currentState;
         gameObject.SetActive(false);
         socket.SetActive(true);
     }
 }
Exemplo n.º 19
0
 public void InformToolPickedUp(Tool.ToolType type, int playerNum)
 {
     if (tutorialActive)
     {
         toolsHeldByDoctor[playerNum] = type;
         OnToolPickedUp(type, playerNum);
         if (type == Tool.ToolType.BUCKET)
         {
             playerHasBucket = playerNum;
         }
         if (type == Tool.ToolType.DEFIBULATOR)
         {
             playerHasDefibulator = playerNum;
         }
         playerHasTool[playerNum] = type;
     }
 }
Exemplo n.º 20
0
 private void AddPlayerCircle(int playerNum, Tool.ToolType toolType, bool check)
 {
     if (playerCircleShown[playerNum])
     {
         return;
     }
     if (current_state != StepCompletePanelState.SHOWING)
     {
         playerBuffer.Add(playerNum);
     }
     else
     {
         int i = 0;
         if (toolType == Tool.ToolType.SCALPEL)
         {
             if (circlesFilled[i] != -1)
             {
                 i = 1;
             }
         }
         else if (toolType == Tool.ToolType.GAUZE)
         {
             i = 2;
         }
         else if (toolType == Tool.ToolType.SUTURE)
         {
             i = 3;
         }
         if (i == 0 && toolType != Tool.ToolType.SCALPEL)
         {
             return;
         }
         if (check)
         {
             AudioControl.Instance.PlayAddTutorialCircle();
         }
         circlesFilled[i]                = playerNum;
         playerCircleShown[playerNum]    = true;
         playerCirclesChecked[playerNum] = check;
         playerCircles[i].GetComponent <PlayerCircle>().SetPlayerNumAndInitiateAnimation(playerNum, check);
     }
 }
Exemplo n.º 21
0
    public override void Interract(Tool.ToolType heldTool, float deltaTime)
    {
        if (Tutorial)
        {
            if (heldTool == Tool.ToolType.ElectricityKit)
            {
                health += repairSpeed * Time.deltaTime;

                if (health > 200f)
                {
                    Working = true;
                    health  = 200f;
                    healthBar.GetComponent <SpriteRenderer>().color = Color.green;
                }

                Vector2 scale = healthBar.transform.localScale;
                scale.x = health / 100;
                healthBar.transform.localScale = scale;
            }
        }
    }
Exemplo n.º 22
0
    public void RepairWithTool(Tool.ToolType toolType)
    {
        switch (toolType)
        {
        case Tool.ToolType.Hammer:
            if (currentState == RepairState.Twisted)
            {
                SpawnVersion(RepairState.Unpainted);
                Instantiate(repairFXPrefab, transform.position, Quaternion.identity);
                SoundManagerScript.instance.PlayOneShotSound(SoundManagerScript.AudioClips.ObjectRepair);
            }
            break;

        case Tool.ToolType.BlowPipe:
            if (currentState == RepairState.Damaged)
            {
                SpawnVersion(RepairState.Unpainted);
                Instantiate(repairFXPrefab, transform.position, Quaternion.identity);
                SoundManagerScript.instance.PlayOneShotSound(SoundManagerScript.AudioClips.ObjectRepair);
            }
            break;
        }
    }
Exemplo n.º 23
0
 public Tool Get_Tool(Tool.ToolType type, int level)
 {
     return((Tool)items.OrderByDescending(x => x is Tool ? (x as Tool).Level : 0).FirstOrDefault(x => x is Tool && (x as Tool).Type == type && (x as Tool).Level >= level));
 }
Exemplo n.º 24
0
 public virtual void Interract(Tool.ToolType heldTool, float deltaTime)
 {
 }
Exemplo n.º 25
0
 public bool Has_Tool(Tool.ToolType type, int level)
 {
     return(Inventory.Has_Tool(type, level));
 }
Exemplo n.º 26
0
 public void OnTutorialGauze()
 {
     Instantiate(gauzeHotspotsPrefab, hotspotSpawnPos);
     requiredTool = Tool.ToolType.GAUZE;
 }
Exemplo n.º 27
0
 private void OnToolForSurgeryPickedUp(Tool.ToolType type)
 {
     actionButtonCanvas.SetActive(true);
     actionButtonCanvas.GetComponent <BounceUpAndDown>().initiateBounce();
 }
Exemplo n.º 28
0
 private void OnToolForSurgeryDropped(Tool.ToolType type)
 {
     actionButtonCanvas.SetActive(false);
 }
Exemplo n.º 29
0
 public void InformToolDropped(Tool.ToolType type, int playerNum)
 {
     toolsHeldByDoctor[playerNum] = Tool.ToolType.NONE;
     OnToolDropped(type, playerNum);
     playerHasTool[playerNum] = Tool.ToolType.NONE;
 }
Exemplo n.º 30
0
 public bool Has_Tool(Tool.ToolType type, int level)
 {
     return(items.Exists(x => x is Tool && (x as Tool).Type == type && (x as Tool).Level >= level));
 }