Esempio n. 1
0
    void Awake()
    {
        groundLayer     = LayerMask.GetMask("Ground");
        rigidbody       = this.GetComponent <Rigidbody>();
        charController1 = this.GetComponentInChildren <charControl>();
        charController2 = this.GetComponentInChildren <scndcharControl>();

        var heros = GameObject.FindObjectsOfType <HeroController>();

        otherhero = (heros[0] == this) ? heros[1] : heros[0];

        switch (kind)
        {
        case Kind.Holder:
            AxisHorz  = "halter_horz";
            AxisVert  = "halter_vert";
            BtnAction = "halter_action";
            break;

        case Kind.Packer:
            AxisHorz  = "packer_horz";
            AxisVert  = "packer_vert";
            BtnAction = "packer_action";
            break;

        case Kind.None:
        default:
            throw new ArgumentOutOfRangeException();
        }
    }
Esempio n. 2
0
    void Start()
    {
        rotSpeed   = 60f;
        charScript = GameObject.FindGameObjectWithTag("player").GetComponent <charControl>();

        displayPoints = GameObject.Find("obesityText").GetComponent <obesityMeasure>();
        speed         = charScript.foodDropSpeed;
    }
Esempio n. 3
0
    void SetCameraTarget(Transform t)
    {
        target = t;

        if (target != null)
        {
            if (target.GetComponent <charControl>())
            {
                charContr = target.GetComponent <charControl>();
            }
            else
            {
                Debug.LogError("The camera's target needs a character controller.");
            }
        }
        else
        {
            Debug.LogError("Your camera needs a target.");
        }
    }