示例#1
0
    private void HandleInteractionInput()
    {
        if (interactablesCollisionList.Count > 0)
        {
            HoleScript hole = interactablesCollisionList[0].GetComponent <HoleScript>();
            if (hole)
            {
                exclamationMark.SetActive(false);
                hole.HoleBehaviour();
            }

            FountainScript fountain = null;
            if (interactablesCollisionList.Count > 0)
            {
                fountain = interactablesCollisionList[0].GetComponent <FountainScript>();
            }
            if (fountain)
            {
                exclamationMark.SetActive(false);
                fountain.OpenFountain();
            }


            BuffsList buffScroll = null;
            if (interactablesCollisionList.Count > 0)
            {
                buffScroll = interactablesCollisionList[0].GetComponent <BuffsList>();
            }
            if (buffScroll)
            {
                exclamationMark.SetActive(false);
                buffScroll.OpenBuffPanel();
            }
        }
    }
 void Start()
 {
     hole         = GameObject.Find("HoleObject");
     holeS        = hole.GetComponent <HoleScript>();
     textUI       = gameObject;
     metalObjects = GameObject.FindGameObjectsWithTag("MetalObject");
 }
示例#3
0
    // Use this for initialization
    void Start()
    {
        hole   = GetComponentInParent <HoleScript> ();
        ball   = MainScript.Get().Ball;
        player = MainScript.Get().Player;
        text   = GetComponentInChildren <Text> ();

        initialScale  = transform.localScale;
        initialHeight = transform.position.y;
    }
示例#4
0
 public void EnterHole(HoleScript enteredHole)
 {
     PreviousHole = CurrentHole;
     CurrentHole.Enable(false);
     CurrentHole = GetNext();
     if (CurrentHole != null)
     {
         CurrentHole.Enable(true);
         MainScript.EnterHole();
     }
     else
     {
         MainScript.Win();
     }
 }
示例#5
0
 public void SetHole(int holeNumber)
 {
     CurrentHole = Holes[holeNumber];
 }
示例#6
0
 void Start()
 {
     holeScript = GetComponentInParent <HoleScript> ();
 }
示例#7
0
    void GetInputAndMove()
    {
        bool left  = Input.GetKey(KeyCode.LeftArrow);
        bool right = Input.GetKey(KeyCode.RightArrow);
        bool up    = Input.GetKey(KeyCode.UpArrow) && ladderUp;
        bool down  = Input.GetKey(KeyCode.DownArrow) && ladderDown;
        bool dig   = Input.GetKey(KeyCode.D);
        bool fill  = Input.GetKey(KeyCode.F);

        if (transform.position.y <= lowestGirder)
        {
            dig = false;                                        // cannot dig on the lowest girder
        }
        float hSpeed = 0;
        float vSpeed = 0;

        if (left)
        {
            hSpeed -= normalSpeed;
        }
        if (right)
        {
            hSpeed += normalSpeed;
        }
        if (up)
        {
            vSpeed += normalSpeed;
        }
        if (down)
        {
            vSpeed -= normalSpeed;
        }
        if (!onGround)
        {
            vSpeed -= fallSpeed;
        }
        if (ladderUp && vSpeed < 0 && transform.position.y < lowestGirder)
        {
            vSpeed = 0;
        }

        if (hSpeed < 0)
        {
            transform.localScale = new Vector3(-2f, 2f, 1);
        }
        if (hSpeed > 0)
        {
            transform.localScale = new Vector3(2f, 2f, 1);
        }

        if ((dig | fill) && onGround)
        {
            hSpeed = 0;
            vSpeed = 0;
        }

        if (dig)
        {
            if (hole == null)
            {
                hole = HoleScript.StartDig(diggerPositionX, transform.position.y);
            }
            else
            {
                hole.GetComponent <HoleScript>().PlayerDig();
            }
        }
        else if (fill)
        {
            if (hole == null)
            {
                hole = HoleScript.FindHole(diggerPositionX, transform.position.y);
                if (hole != null)
                {
                    hole.GetComponent <HoleScript>().StartFill();
                }
            }
            else
            {
                hole.GetComponent <HoleScript>().PlayerFill();
            }
        }

        if (hole != null)
        {
            digger.SetActive(true);
        }
        else
        {
            digger.SetActive(false);
        }



        rb.velocity = new Vector3(hSpeed, vSpeed, 0);
    }