Exemple #1
0
    public bool CanInteractWith(Action action, Clickable target)
    {
        if (!target.enabled)
        {
            return(false);
        }

        if (interactions == null)
        {
            interactions = new Dictionary <Action, List <Clickable> >();
            for (int i = 0; i < actions.Count; i++)
            {
                if (!interactions.ContainsKey(actions[i]))
                {
                    interactions[actions[i]] = new List <Clickable>();
                }
                interactions[actions[i]].Add(targets[i]);
            }
        }

        if (interactions.ContainsKey(action))
        {
            foreach (Clickable c in interactions[action])
            {
                if (c.GetType() == target.GetType())
                {
                    PlaySound(yesTrack);
                    return(true);
                }
            }
        }
        PlaySound(noTrack);
        return(false);
    }
Exemple #2
0
        /// <summary>
        /// Execute clickable logic
        /// </summary>
        protected void ClickClickable()
        {
            switch (currentClickable.GetType().ToString())
            {
            case "InGamePaint.BrushPreset": ApplyPreset((BrushPreset)currentClickable); break;

            case "InGamePaint.ColorPreset": MixColor(((ColorPreset)currentClickable).color, 1f, false); break;
            }
        }
Exemple #3
0
 public override void Interact(Action action, Clickable target)
 {
     if (action == Action.PICKUP_PLANT)
     {
         Cauldron c = FindObjectOfType <Cauldron>();
         if (!c.IsFull())
         {
             if (target.GetType() == typeof(Plant1))
             {
                 NextState = OldManState02.GOING1;
             }
             else if (target.GetType() == typeof(Plant2))
             {
                 NextState = OldManState02.GOING2;
             }
             else
             {
                 NextState = OldManState02.GOING3;
             }
         }
     }
 }
Exemple #4
0
    public override void Interact(Action action, Clickable target)
    {
        if (CurrentState == State.IDLE && action == Action.PICKUP_WOOD)
        {
            if (target.GetType() == typeof(Tree))
            {
                Tree t = (Tree)target;
                if (!t.beingCut)
                {
                    if (t.gameObject.GetInstanceID() == tree1.GetInstanceID())
                    {
                        woodTarget = treeTarget1;
                    }
                    else
                    {
                        woodTarget = treeTarget2;
                    }

                    t.beingCut = true;
                    nextState  = State.GOING_TOWARDS_WOOD;
                }
            }
        }
    }