示例#1
0
 public void ExchangeItem(RoBootCondition temp)
 {
     item.hand = item.hand == Hand.None ? item.hand : temp.hand;
     item.body = item.body == Body.None ? item.body : temp.body;
     item.leg  = item.leg == Leg.None ? item.leg : temp.leg;
     UpdateItem();
 }
示例#2
0
 public bool IsEqual(RoBootCondition temp)
 {
     if (hand == temp.hand && body == temp.body && leg == temp.leg)
     {
         return(true);
     }
     return(false);
 }
示例#3
0
    public void PickItem(RoBootCondition item)
    {
        // Called when picking up item
        RoBootCondition temp = new RoBootCondition();

        temp.Update(GameManager.instance.condition);

        temp.hand = item.hand == Hand.None ? temp.hand : item.hand;
        temp.body = item.body == Body.None ? temp.body : item.body;
        temp.leg  = item.leg == Leg.None ? temp.leg : item.leg;


        UpdateRoBoot(temp);
    }
示例#4
0
    private void Update()
    {
        // Jump
        if (!m_Jump)
        {
            m_Jump = Input.GetButtonDown("Jump");
        }

        // Pick Item
        if (Input.GetKeyDown(KeyCode.F) && m_TargetItem != null)
        {
            RoBootCondition temp = new RoBootCondition();
            temp.Update(m_TargetItem.item);
            m_TargetItem.ExchangeItem(GameManager.instance.condition);
            m_RoBoot.PickItem(temp);
        }

        if (Input.GetKeyDown(KeyCode.F) && m_DoorTrigger != null && GameManager.instance.condition.hand == Hand.Plug)
        {
            m_DoorTrigger.isTriggered = true;
        }

        // Debug Code
        if (Input.GetKeyDown(KeyCode.Q))
        {
            m_RoBoot.UpdateCollider(new RoBootCondition()
            {
                body = Body.None, leg = Leg.None
            });
        }
        if (Input.GetKeyDown(KeyCode.W))
        {
            m_RoBoot.UpdateCollider(new RoBootCondition()
            {
                body = Body.None, leg = Leg.Goal
            });
        }
        if (Input.GetKeyDown(KeyCode.E))
        {
            m_RoBoot.UpdateCollider(new RoBootCondition()
            {
                body = Body.Goal, leg = Leg.Goal
            });
        }
    }
示例#5
0
    public void UpdateRoBoot(RoBootCondition condition)
    {
        if (condition.leg == Leg.Spring)
        {
            m_JumpableCoe = 1.1f;
        }
        else
        {
            m_JumpableCoe = 0.6f;
        }

        if (condition.leg == Leg.Magnet)
        {
            m_IsMag = true;
        }
        else
        {
            m_IsMag = false;
        }
        UpdateCollider(condition);
        UpdateParts(condition);
        GameManager.instance.UpdateAudio();
    }
示例#6
0
 public void UpdateCondition(RoBootCondition update)
 {
     condition = update;
 }
示例#7
0
 public void Update(RoBootCondition temp)
 {
     hand = temp.hand;
     body = temp.body;
     leg  = temp.leg;
 }
示例#8
0
    public void UpdateCollider(RoBootCondition condition)
    {
        // Update different level of collider
        if (GameManager.instance.condition.IsEqual(condition))
        {
            //Debug.Log("Same");
            return;
        }


        GameManager.instance.condition.Update(condition);
        if (condition.leg == Leg.None && condition.body == Body.None)
        {
            m_LegPart  = null;
            m_BodyPart = null;
            m_Upper.SetActive(false);
            m_Lower.SetActive(false);
            m_Hand1.SetActive(true);
            m_Hand2.SetActive(false);
            m_GroundCheck.position = m_Transform.position - new Vector3(0.0f, 0.47f, 0.0f);
        }
        else if (condition.leg != Leg.None && condition.body == Body.None)
        {
            //m_LegPart = GameObject.Find("Upper");
            m_LegPart  = m_Upper;
            m_BodyPart = null;
            if (!m_Upper.activeInHierarchy)
            {
                m_Transform.position += new Vector3(0.0f, 1.0f, 0.0f);
            }
            m_Upper.SetActive(true);
            m_Lower.SetActive(false);
            m_Hand1.SetActive(false);
            m_Hand2.SetActive(true);
            m_GroundCheck.position = m_Transform.position - new Vector3(0.0f, 1.47f, 0.0f);
        }
        else if (condition.leg != Leg.None && condition.body != Body.None)
        {
            m_LegPart  = m_Lower;
            m_BodyPart = m_Upper;
            if (!m_Upper.activeInHierarchy)
            {
                m_Transform.position += new Vector3(0.0f, 3.0f, 0.0f);
                if (!m_Lower.activeInHierarchy)
                {
                    //Debug.Log("f**k");
                    //m_Transform.position += new Vector3(0.0f, 5.0f, 0.0f);
                }
            }
            m_Upper.SetActive(true);
            m_Lower.SetActive(true);
            m_Hand1.SetActive(false);
            m_Hand2.SetActive(true);
            m_GroundCheck.position = m_Transform.position - new Vector3(0.0f, 2.47f, 0.0f);
        }
        else
        {
            m_BodyPart = m_Upper;
            m_LegPart  = null;
            if (!m_Upper.activeInHierarchy)
            {
                m_Transform.position += new Vector3(0.0f, 1.0f, 0.0f);
            }
            m_Upper.SetActive(true);
            m_Lower.SetActive(false);
            m_Hand1.SetActive(false);
            m_Hand2.SetActive(true);
            m_GroundCheck.position = m_Transform.position - new Vector3(0.0f, 1.47f, 0.0f);
        }
    }
示例#9
0
    public void UpdateParts(RoBootCondition condition)
    {
        // Load the sprite of body parts
        string bodyPath = "";
        string legPath  = "";
        string handPath = "";

        if (condition.hand != Hand.None)
        {
            switch (condition.hand)
            {
            case Hand.Plug:
                handPath = "Sprites/HandPlug";
                break;

            case Hand.Drill:
                handPath = "Sprites/HandDrill";
                break;

            case Hand.Goal:
                handPath = "Sprites/HandGoal";
                break;
            }
        }
        if (condition.body != Body.None)
        {
            switch (condition.body)
            {
            case Body.Light:
                bodyPath = "Sprites/BodyLight";
                break;

            case Body.Hanger:
                bodyPath = "Sprites/BodyHanger";
                break;

            case Body.Goal:
                bodyPath = "Sprites/BodyGoal";
                break;
            }
        }
        if (condition.leg != Leg.None)
        {
            switch (condition.leg)
            {
            case Leg.Magnet:
                legPath = "Sprites/LegMagnet";
                break;

            case Leg.Spring:
                legPath = "Sprites/LegSpring";
                break;

            case Leg.Goal:
                legPath = "Sprites/LegGoal";
                break;
            }
        }
        //Debug.Log("The Path is: " + tempPath);
        if (m_BodyPart != null)
        {
            m_BodyPart.GetComponentInChildren <SpriteRenderer>().sprite = Resources.Load <Sprite>(bodyPath);
            //Debug.Log("The BodyPath is: " + bodyPath);
        }
        else
        {
            //Debug.Log("Body part is Null!");
        }

        if (m_LegPart != null)
        {
            m_LegPart.GetComponentInChildren <SpriteRenderer>().sprite = Resources.Load <Sprite>(legPath);
            //Debug.Log("The LegPath is: " + legPath);
        }
        else
        {
            //Debug.Log("Leg part is Null!");
        }

        if (m_Hand1 != null && m_Hand2 != null)
        {
            Debug.Log("The HandPath is: " + handPath);
            m_Hand1.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>(handPath);
            m_Hand2.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>(handPath);
            //Debug.Log("The HandPath is: " + handPath);
        }
        else
        {
            Debug.Log("Hand part is Null!");
        }
    }
示例#10
0
 private void Awake()
 {
     item = new RoBootCondition(hand, body, leg);
     UpdateItem();
 }