Beispiel #1
0
        public void Start()
        {
            /*Plane groundPlane = (Plane) GameObject.FindObjectOfType(typeof(Plane));
             * if (groundPlane == null) Debug.LogError("Plane not found. Please add a plane mesh to your stage prefab!");*/

            groundLayer      = LayerMask.NameToLayer("Ground");
            groundMask       = 1 << groundLayer;
            myControlsScript = GetComponent <ControlsScript>();
            character        = myControlsScript.character;
            myHitBoxesScript = character.GetComponent <HitBoxesScript>();
            myMoveSetScript  = character.GetComponent <MoveSetScript>();
            appliedGravity   = myControlsScript.myInfo.physics.weight * UFE.config.gravity;

            walkSpeed = myControlsScript.myInfo.physics.walkSpeed;
            runSpeed  = myControlsScript.myInfo.physics.runSpeed;
        }
Beispiel #2
0
        // Use this for initialization
        void Start()
        {
            //inputReferences = UFE.inputConfig.inputReferences;

            myPhysicsScript = GetComponent <PhysicsScript>();
            if (gameObject.name == "Player1")
            {
                myInfo          = (CharacterInfo)Instantiate(UFE.config.player1Character);
                inputReferences = UFE.config.player1_Inputs;
                opponent        = GameObject.Find("Player2");
            }
            else
            {
                myInfo          = (CharacterInfo)Instantiate(UFE.config.player2Character);
                inputReferences = UFE.config.player2_Inputs;
                opponent        = GameObject.Find("Player1");
            }

            character = (GameObject)Instantiate(myInfo.characterPrefab);
            character.transform.parent = transform;
            character.AddComponent <MoveSetScript>();
            myHitBoxesScript = character.GetComponent <HitBoxesScript>();
            myMoveSetScript  = character.GetComponent <MoveSetScript>();
        }
Beispiel #3
0
        void Start()
        {
            controlsScript  = transform.parent.gameObject.GetComponent <ControlsScript>();
            myMoveSetScript = GetComponent <MoveSetScript>();
            detect3dHits    = UFE.config.detect3D_Hits;

            foreach (HitBox hitBox in hitBoxes)
            {
                hitBox.storedRadius = hitBox.radius;
            }

            foreach (MoveInfo move in myMoveSetScript.moves)
            {
                foreach (InvincibleBodyParts invBodyPart in move.invincibleBodyParts)
                {
                    List <HitBox> invHitBoxes = new List <HitBox>();
                    foreach (BodyPart bodyPart in invBodyPart.bodyParts)
                    {
                        foreach (HitBox hitBox in hitBoxes)
                        {
                            if (bodyPart == hitBox.bodyPart)
                            {
                                invHitBoxes.Add(hitBox);
                                break;
                            }
                        }
                    }
                    invBodyPart.hitBoxes = invHitBoxes.ToArray();
                }

                foreach (HitBox hitBox in hitBoxes)
                {
                    if (move.blockableArea.bodyPart == hitBox.bodyPart)
                    {
                        move.blockableArea.position = hitBox.position;
                        break;
                    }
                }

                foreach (Hit hit in move.hits)
                {
                    foreach (HitBox hitBox in hitBoxes)
                    {
                        if (hit.pullEnemyIn.characterBodyPart == hitBox.bodyPart)
                        {
                            hit.pullEnemyIn.position = hitBox.position;
                            break;
                        }
                    }
                    foreach (HurtBox hurtBox in hit.hurtBoxes)
                    {
                        foreach (HitBox hitBox in hitBoxes)
                        {
                            if (hurtBox.bodyPart == hitBox.bodyPart)
                            {
                                hurtBox.position = hitBox.position;
                                break;
                            }
                        }
                    }
                }

                foreach (Projectile projectile in move.projectiles)
                {
                    foreach (HitBox hitBox in hitBoxes)
                    {
                        if (projectile.bodyPart == hitBox.bodyPart)
                        {
                            projectile.position = hitBox.position;
                        }
                    }
                }
            }
        }