Пример #1
0
    // Start is called before the first frame update
    void Start()
    {
        currentState = new GroundedState();

        input         = gameObject.AddComponent <PlayerInputManager>();
        activeRagdoll = GetComponent <ActiveRagdoll>();

        if (handR)
        {
            GameObject hookGunGO = (GameObject)Instantiate(Resources.Load("Prefabs/HookGun"));
            HookGun    hookGun   = hookGunGO.GetComponent <HookGun>();
            hookGun.Equip(handR, handR.position + 0.25f * handR.transform.forward,
                          handR.rotation, false);
            hookGun.setControls(1);
            hookGun.setColor(Color.red);
            hookGun.cursor.cursorImage = cursorImage;
        }

        if (handL)
        {
            GameObject   magnetoGloveGO = new GameObject();
            MagnetoGlove magnetoGlove   = magnetoGloveGO.AddComponent <MagnetoGlove>();
            magnetoGlove.Equip(handL, handL.position, handL.rotation, false);

            /*
             * GameObject ballHookGunGO = (GameObject)Instantiate(Resources.Load("Prefabs/HookGun"));
             * HookGun ballHookGun = ballHookGunGO.GetComponent<HookGun>();
             * ballHookGun.AttachTo(handL, handL.position + 0.25f * handL.transform.forward,
             *              handL.rotation, false);
             * ballHookGun.setControls(0);
             * ballHookGun.setColor(Color.blue);
             * ballHookGun.cursor.cursorImage = cursorImage;
             */
        }
    }
Пример #2
0
 private void Awake()
 {
     hookGunObj  = transform.GetChild(0).gameObject;
     hookObj     = hookGunObj.transform.GetChild(0).gameObject;
     hookGun     = hookGunObj.GetComponent <HookGun>();
     moveControl = GetComponent <MoveControl>();
 }