Inheritance: MonoBehaviour
Ejemplo n.º 1
0
    protected override void Awake()
    {
        base.Awake();

        ItemNeeded = "Beerbottle";
        ikcontrol  = GetComponentInChildren <IKControl>();
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Start is called on the frame when a script is enabled just before
    /// any of the Update methods is called the first time.
    /// </summary>
    void Start()
    {
        winnerPID  = "";
        winnerAdrs = "";
        winnerName = "";


        _playfabUser = FindObjectOfType <PlayfabUser>();


        Debug.Log(_playfabUser.Instance.Address + "\n" + _playfabUser.Instance.PrivateKey);

        /*EtherTransferCoroutinesUnityWebRequest eth = GameObject.FindGameObjectWithTag("ETH")
         *  .GetComponent<EtherTransferCoroutinesUnityWebRequest>(); */

        eth = FindObjectOfType <EtherTransferCoroutinesUnityWebRequest>();


        fpController  = GetComponent <FirstPersonController>();
        ikControl     = GetComponentInChildren <IKControl>();
        damageImage   = GameObject.FindGameObjectWithTag("Screen").transform.Find("DamageImage").GetComponent <Image>();
        healthSlider  = GameObject.FindGameObjectWithTag("Screen").GetComponentInChildren <Slider>();
        currentHealth = startingHealth;
        if (photonView.IsMine)
        {
            gameObject.layer   = LayerMask.NameToLayer("FPSPlayer");
            healthSlider.value = currentHealth;
        }
        damaged   = false;
        isDead    = false;
        isSinking = false;
    }
Ejemplo n.º 3
0
    public IKModelController(IModelDataManager mdm, IKControl ik)
    {
        modelDataManager = mdm;
        modelDataManager.SubscribeReceiver(this);

        AssignIKModel(ik);
    }
Ejemplo n.º 4
0
        public override void OnInspectorGUI()
        {
            DrawDefaultInspector();

            IKControl myScript = (IKControl)target;

            if (!myScript.isControlling) // only able to save rotations if you aren't animating
            {
                if (GUILayout.Button("Save rotations and start animation"))
                {
                    myScript.SaveRotations();
                }
            }


            if (GUILayout.Button("Return to original rotations"))
            {
                myScript.ReturnToRotations(true);
                //myScript.SaveRotations();
            }
            if (GUILayout.Button("Stop animations and return to original rotations"))
            {
                myScript.isControlling = false;
                myScript.ReturnToRotations(true);
            }
        }
Ejemplo n.º 5
0
    // Use this for initialization
    void Start()
    {
        anim         = GetComponent <Animator>();
        ikContorl    = GetComponent <IKControl>();
        rightTrigger = rightHadukenTrigger.GetComponent <BoxCollider>();
        leftTrigger  = leftHadukenTrigger.GetComponent <BoxCollider>();

        moves = new Move[moveFiles.Length];
        for (int i = 0; i < moves.Length; i++)
        {
            moves[i] = new Move();
        }

        /*for (int i = 0; i < moveFiles.Length; i++ )
         * {
         *  var hitboxes = importAttack(moveFiles[i]).hitboxes;
         *  foreach (HitboxJS  hbox in hitboxes)
         *  {
         *      //GameObject go = new GameObject();
         *      //go.AddComponent<MeshFilter>(
         *      GameObject go = GameObject.CreatePrimitive(PrimitiveType.Cube);
         *      go.transform.SetParent(transform);
         *      Vector3 offset = floatVectorToVector(hbox.offset);
         *      offset.Scale(transform.localScale);
         *      go.transform.localPosition = offset;
         *      go.transform.eulerAngles = floatVectorToVector(hbox.rotation);
         *      Vector3 scale = floatVectorToVector(hbox.scale);
         *      scale.Scale(transform.localScale);
         *      go.transform.localScale = scale;
         *
         *  }
         * }*/
        for (int i = 0; i < moveFiles.Length; i++)
        {
            MoveJS move     = importAttack(moveFiles[i]);
            var    hitboxes = move.hitboxes;
            moves[i].hitboxes = new GhostHBox[hitboxes.Length];
            moves[i].duration = move.duration;
            for (int j = 0; j < hitboxes.Length; j++)
            {
                Transform temp = Instantiate(prefab, new Vector3(0, 0, 0), Quaternion.identity);
                GhostHBox g    = temp.GetComponent <GhostHBox>();
                temp.SetParent(transform);
                temp.localScale       = floatVectorToVector(hitboxes[j].scale);
                temp.localEulerAngles = floatVectorToVector(hitboxes[j].rotation);
                temp.localPosition    = floatVectorToVector(hitboxes[j].offset);
                temp.name             = hitboxes[j].name;
                g.beginFrame          = hitboxes[j].beginFrame;
                g.duration            = hitboxes[j].duration;
                g.damage             = hitboxes[j].damage;
                g.hitStun            = hitboxes[j].hitStun;
                g.launchVector       = floatVectorToVector(hitboxes[j].launchVector);
                g.linearVelocity     = floatVectorToVector(hitboxes[j].linearVelocity);
                g.angularVelocity    = floatVectorToVector(hitboxes[j].angularVelocity);
                g.scaleVelocity      = floatVectorToVector(hitboxes[j].scaleVelocity);
                moves[i].hitboxes[j] = g;
            }
        }
    }
Ejemplo n.º 6
0
 protected void Init()
 {
     Debug.Log("Actor Awake()");
     gunController = GetComponent <GunController>();
     anim          = GetComponent <Animator>();
     gun           = GetComponentInChildren <Gun>();
     IK            = GetComponent <IKControl>();
 }
Ejemplo n.º 7
0
    private void AssignIKModel(IKControl ikControl)
    {
        this.ikControl = ikControl;

        //if (this.ikControl == null)
        //    return;
        //ikBody = this.ikControl.transform;
    }
Ejemplo n.º 8
0
    public override bool Init(IKControl control, Transform p)
    {
        base.Init(control, p);

        v3bones = new Vector3[bdArr_data.Length - 1];

        return(true);
    }
    //public Image btnImage;
    //public Sprite onsprite, offsprite;


    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.H))
        {
            docIkControl = GameObject.FindGameObjectWithTag("LocalPlayer").transform.GetChild(0).GetComponent <IKControl>();
            ExamineBreast();
        }
    }
Ejemplo n.º 10
0
 //Quaternion lastRotation;
 // Use this for initialization
 void Start()
 {
     noSamba         = horns.outputAudioMixerGroup.audioMixer.FindSnapshot("NotSamba");
     sambaSnap       = horns.outputAudioMixerGroup.audioMixer.FindSnapshot("Samba");
     anim            = GetComponent <Animator>();
     ikControl       = GetComponent <IKControl>();
     status          = GetComponent <Status>();
     multiDecayTimer = 1;
 }
Ejemplo n.º 11
0
        private IKControl ReadIKControl()
        {
            var control = new IKControl();

            control.Name    = ReadString(20);
            control.Enabled = _reader.ReadBoolean();

            return(control);
        }
Ejemplo n.º 12
0
    private bool GetIK()
    {
        if (ikControl == null)
        {
            ikControl = FindObjectOfType <IKControl>();
        }

        return(ikControl != null);
    }
Ejemplo n.º 13
0
 private void CreateControls()
 {
     foreach (Transform effector in _effectors)
     {
         IKControl effectorUI = Instantiate(_ikControlTemplate, GetComponent <RectTransform>());
         effectorUI.SetEffector(effector);
         _controls.Add(effectorUI);
     }
 }
Ejemplo n.º 14
0
 private void Start()
 {
     Halo.enabled              = false;
     gamePlayManager           = FindObjectOfType <GamePlayManager>();
     IKControlScript           = GetComponentInParent <IKControl>();
     studentAction             = GetComponentInParent <StudentAction>();
     playerCamera              = Camera.main;
     updateStudentSelectedData = false;
 }
Ejemplo n.º 15
0
    public SecondPassBase(IKControl parent)
    {
        PAM = parent;
        G   = parent.IKCS;

        numBones = G.i_IKparents + 1;
        bd_data  = new BoneData[numBones];

        Setup();
    }
Ejemplo n.º 16
0
 private void Select()
 {
     foreach (IKControl control in _controls)
     {
         if (control.Rect.Contains(Input.mousePosition) && control.IsActive)
         {
             _selectedControl = control;
             control.Activate();
         }
     }
 }
Ejemplo n.º 17
0
    void Start()
    {
        stackColorCode    = DataScript.currentColorCode;
        isFallingFinished = false;
        isFallingOnGround = false;
        height            = 0;
        ikControl         = GetComponentInParent <IKControl>();
        collectedCubes    = new List <Transform>();

        gameMngr         = FindObjectOfType(typeof(GameMngr)) as GameMngr;
        playerController = GetComponentInParent <PlayerController>();
    }
Ejemplo n.º 18
0
        private void AssignIKModel(IKControl ikControl)
        {
            this.ikControl = ikControl;

            //if (this.ikControl == null)
            //    return;
            //ikBody = this.ikControl.transform;
            //if (this.ikControl.rightFootObj || this.ikControl.leftFootObj)
            //    return;
            //ik.rightFootObj = rightFoot;
            //ik.leftFootObj = leftFoot;
        }
Ejemplo n.º 19
0
    private void Awake()
    {
        navMeshAgent = GetComponentInChildren <NavMeshAgent>();
        //navMeshAgent.updatePosition = false;
        navMeshAgent.updateRotation = false;
        navMeshAgent.updateUpAxis   = false;
        movement          = GetComponentInChildren <CharacterMovement>();
        perlinYCoordinate = Random.Range(0, 100);
        iKControl         = GetComponentInChildren <IKControl>();

        StartCoroutine(KonfettiTimer());
    }
Ejemplo n.º 20
0
    public virtual void OnDrop(Transform player)
    {
        held          = false;
        holdingPlayer = null;

        IKControl ik = player.GetComponentInChildren <IKControl>();

        ik.ikActive     = false;
        ik.leftHandObj  = null;
        ik.rightHandObj = null;

        Destroy(gameObject.GetComponent <SpringJoint>());
    }
Ejemplo n.º 21
0
 private void GetComponents()
 {
     _jobManager          = FindObjectOfType <JobManager>();
     vitals               = GetComponent <Vitals>();
     aiVitals             = GetComponent <AiVitals>();
     fieldOfView          = GetComponent <FieldOfView>();
     inventory            = GetComponentInChildren <GenericInventory>();
     navAgent             = GetComponent <NavMeshAgent>();
     animator             = GetComponent <Animator>();
     weaponHolder         = GetComponent <WeaponHolder>();
     iKControl            = GetComponent <IKControl>();
     thirdPersonCharacter = GetComponent <ThirdPersonCharacter>();
 }
Ejemplo n.º 22
0
    //PlayerScore score;

    // Called when script awake in editor
    void Awake()
    {
        playerAudio     = GetComponent <AudioSource>();
        playerShooting  = GetComponentInChildren <GunShooting>();
        capsuleCollider = GetComponent <CapsuleCollider>();
        fps             = GetComponent <FirstPersonController>();
        ikControl       = GetComponentInChildren <IKControl>();
        //score = GetComponent<PlayerScore>();
        healthSlider       = GameObject.FindGameObjectWithTag("Screen").GetComponentInChildren <Slider>();
        damageImage        = GameObject.FindGameObjectWithTag("Screen").transform.Find("DamageImage").GetComponent <Image>();
        currentHealth      = startingHealth;
        healthSlider.value = currentHealth;
    }
Ejemplo n.º 23
0
    private void Deselect()
    {
        _selectedControl = null;

        foreach (IKControl control in _controls)
        {
            if (!control.IsActive)
            {
                continue;
            }

            control.Deactivate();
        }
    }
Ejemplo n.º 24
0
        // Use this for initialization
        void Start()
        {
            //playerHead = GameObject.FindGameObjectWithTag ("HelmetSlot");
            audioSource = gameObject.GetComponent <AudioSource> ();
            ik          = GetComponent <IKControl>();
            anim        = GetComponent <Animator>();
            SetEquippedWeapon(null);
            aim = new GameObject();

            Initilize();

            equippedWeapon   = null;
            punchSoundPlayed = false;
        }
Ejemplo n.º 25
0
    public override bool Init(IKControl control, Transform p)
    {
        base.Init(control, p);

        boneLengths = new float[bdArr_data.Length - 1];

        // Get the length of each bone
        for (int i = 0; i < bdArr_data.Length - 1; i++)
        {
            boneLengths[i] = (bdArr_data[i + 1].position - bdArr_data[i].position).magnitude;
        }
        //		positionAccuracy = legLength*0.001f;

        return(true);
    }
Ejemplo n.º 26
0
 /// <summary>
 /// Start is called on the frame when a script is enabled just before
 /// any of the Update methods is called the first time.
 /// </summary>
 void Start()
 {
     fpController  = GetComponent <FirstPersonController>();
     ikControl     = GetComponentInChildren <IKControl>();
     damageImage   = GameObject.FindGameObjectWithTag("Screen").transform.Find("DamageImage").GetComponent <Image>();
     healthSlider  = GameObject.FindGameObjectWithTag("Screen").GetComponentInChildren <Slider>();
     currentHealth = startingHealth;
     if (photonView.IsMine)
     {
         healthSlider.value = currentHealth;
     }
     damaged   = false;
     isDead    = false;
     isSinking = false;
 }
Ejemplo n.º 27
0
    // Use this for initialization
    protected void Initialize()
    {
        pickup               = false;
        inventory            = new List <GameObject>();
        maxInventorySize     = 10;
        ammoInventorySize    = 0;
        itemInventorySize    = 0;
        currentInventorySize = 0;
        weapons              = new GameObject[2];
        ik              = GetComponent <IKControl>();
        anim            = GetComponent <Animator>();
        weaponManager   = GetComponent <WeaponManager> ();
        characterStatus = gameObject.GetComponent <Status>();

        //used for ignoring the character when raycasting in 3rd person
        // TODO
        mask = 1 << 8;
        mask = ~mask;

        //change to how many weapons in game
        ammo = new int[4];

        // simply creating an empty game object to use for the slot objects rather than the Mixamo body parts
        // prefered to do it in code rather than on the prefabs
        GameObject helmetTemp = new GameObject();

        helmetTemp.transform.position = helmetSlot.transform.position;
        helmetTemp.transform.rotation = helmetSlot.transform.rotation;
        helmetTemp.transform.SetParent(helmetSlot.transform);
        helmetSlot      = helmetTemp;
        helmetSlot.name = "Helmet Slot";

        GameObject backpackTemp = new GameObject();

        backpackTemp.transform.position = backpackSlot.transform.position;
        backpackTemp.transform.rotation = backpackSlot.transform.rotation;
        backpackTemp.transform.SetParent(backpackSlot.transform);
        backpackSlot      = backpackTemp;
        backpackSlot.name = "Backpack Slot";

        GameObject vestTemp = new GameObject();

        vestTemp.transform.position = vestSlot.transform.position;
        vestTemp.transform.rotation = vestSlot.transform.rotation;
        vestTemp.transform.SetParent(vestSlot.transform);
        vestSlot      = vestTemp;
        vestSlot.name = "Vest Slot";
    }
Ejemplo n.º 28
0
    //Sets references
    public virtual void Awake()
    {
        thisAgent = GetComponent <NavMeshAgent>();
        thisBody  = GetComponent <Rigidbody>();
        control   = GetComponent <IKControl>();

        if (PhotonNetwork.IsConnected)
        {
            if (!PhotonNetwork.IsMasterClient)
            {
                thisBody.constraints = RigidbodyConstraints.FreezeAll;
                Destroy(thisAgent);
                Destroy(this);
            }
        }
    }
Ejemplo n.º 29
0
 private void GatherPlayerComponents()
 {
     playerController   = GetComponentInChildren <PlayerController>();
     weaponChargeCanvas = GetComponentInChildren <WeaponChargeCanvas>();
     rb                  = GetComponentInChildren <Rigidbody>();
     playerCam           = GetComponentInChildren <PlayerCamera>();
     entity              = GetComponentInChildren <Entity>();
     weaponSlot          = GetComponentInChildren <WeaponSlot>();
     helmetSlot          = GetComponentInChildren <HelmetSlot>();
     trinketSlot         = GetComponentInChildren <TrinketSlot>();
     myInventory         = GetComponentInChildren <Inventory>();
     dwarfAnimController = GetComponentInChildren <DwarfAnimationsScript>();
     dwarfAnimEvents     = GetComponentInChildren <AnimationEventsDwarf>();
     iKControl           = GetComponentInChildren <IKControl>();
     playerAppearance    = GetComponentInChildren <PlayerAppearance>();
     reviveZone          = GetComponentInChildren <ReviveZone>();
     cameraShake         = GetComponentInChildren <CameraShake>();
 }
Ejemplo n.º 30
0
        private VmdIKFrame ReadIKFrame()
        {
            var frame = new VmdIKFrame();

            frame.FrameIndex = _reader.ReadInt32();
            frame.Visible    = _reader.ReadBoolean();

            var ikCount = _reader.ReadInt32();
            var iks     = new IKControl[ikCount];

            for (var i = 0; i < ikCount; ++i)
            {
                iks[i] = ReadIKControl();
            }

            frame.IKControls = iks;

            return(frame);
        }
Ejemplo n.º 31
0
    // Use this for initialization
    void Start()
    {
        Wilson = GameObject.Find ("Wilson");
        Diana = GameObject.Find ("Diana");
        animator = Wilson.GetComponent<Animator> ();
        relationTracker = GameObject.Find ("BehaviorController").GetComponent<RelationTracker> ();
        eventManager = GameObject.Find ("BehaviorController").GetComponent<EventManager> ();

        leftGrasper = animator.GetBoneTransform (HumanBodyBones.LeftHand).transform.gameObject;
        rightGrasper = animator.GetBoneTransform (HumanBodyBones.RightHand).transform.gameObject;

        graspController = Wilson.GetComponent<GraspScript> ();

        ikControl = Wilson.GetComponent<IKControl> ();
        leftTarget = ikControl.leftHandObj.GetComponent<IKTarget> ();
        rightTarget = ikControl.rightHandObj.GetComponent<IKTarget> ();
        headTarget = ikControl.lookObj.GetComponent<IKTarget> ();

        outputModality = GameObject.Find ("OutputModality").GetComponent<OutputModality>();

        goBack = false;

        currentStep = DemoStep.Step0;
        waitTimer = new Timer (WAIT_TIME);
        waitTimer.Enabled = false;
        waitTimer.Elapsed += Proceed;

        humanMoveComplete = false;
        leftAtTarget = false;
        rightAtTarget = false;
        eventManager.EventComplete += HumanMoveComplete;
        leftTarget.AtTarget += LeftAtTarget;
        rightTarget.AtTarget += RightAtTarget;
    }
Ejemplo n.º 32
0
 public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     ikControl = GameObject.FindGameObjectWithTag ("Animator").GetComponent<IKControl> ();
     ikControl.movement = 1;
     timer = 0;
 }