Наследование: MonoBehaviour
 void WasShot(Shoot.BulletInfo hit)
 {
     if (hit.hitInfo.rigidbody)
             hit.hitInfo.rigidbody.AddForceAtPosition (hit.ray.direction * hit.force, hit.hitInfo.point, ForceMode.Impulse);
         else
             transform.FindChild("Root").rigidbody.AddForceAtPosition (hit.ray.direction * hit.force, hit.hitInfo.point, ForceMode.Impulse);
 }
Пример #2
0
 //public bool hello;
 // Use this for initialization
 void Start()
 {
     //fireEffect.Play();
     //fireEffect.loop = true;
     me = GameObject.FindGameObjectWithTag ("Player");
     shootScript = me.GetComponent<Shoot>();
 }
Пример #3
0
            public static Base Parse(Client client)
            {
                NetReader reader = client.Reader;
                var shoot = new Shoot(client);

                shoot.EntityID = reader.ReadUInt64();
                shoot.ChunkX = reader.ReadInt32();
                shoot.ChunkY = reader.ReadInt32();
                shoot.something5 = reader.ReadUInt32();
                reader.ReadBytes(4);
                shoot.Position = reader.ReadQVector3();
                shoot.something13 = reader.ReadUInt32();
                shoot.something14 = reader.ReadUInt32();
                shoot.something15 = reader.ReadUInt32();
                shoot.Velocity = reader.ReadVector3();
                shoot.something19 = reader.ReadSingle();
                shoot.something20 = reader.ReadSingle();
                shoot.something21 = reader.ReadSingle();
                shoot.something22 = reader.ReadSingle();
                shoot.something23 = reader.ReadUInt32();
                shoot.something24 = reader.ReadByte();
                reader.ReadBytes(3);
                shoot.something25 = reader.ReadUInt32();
                shoot.something26 = reader.ReadByte();
                reader.ReadBytes(3);
                shoot.something27 = reader.ReadUInt32();
                shoot.something28 = reader.ReadUInt32();

                return shoot;
            }
Пример #4
0
 void Awake()
 {
     inputState = GetComponent<InputState> ();
     walkBehavior = GetComponent<Walk> ();
     animator = GetComponent<Animator> ();
     collisionState = GetComponent<CollisionState> ();
     shootBehavior = GetComponent<Shoot> ();
 }
Пример #5
0
 void Start()
 {
     rib = GetComponent<Rigidbody2D> ();
     shootScript = GetComponentInChildren<Shoot> ();
     canFadeIn = true;
     canShoot = false;
     StartCoroutine (Cooldown ());
 }
 void MakeParticles(Shoot.BulletInfo info)
 {
     foreach(ParticleSystem particle in particles) {
         Quaternion rotation = Quaternion.LookRotation(info.hitInfo.normal);
         ParticleSystem newParticle = (ParticleSystem) Instantiate(particle, info.hitInfo.point+info.hitInfo.normal*offset, rotation);
         newParticle.transform.parent = transform.root;
     }
 }
Пример #7
0
    //public MonoBehaviour controller;
    // Use this for initialization
    void Start()
    {
        cubeNum = 10;
        this.guiText.text = "Cubes: " + cubeNum;

        me = GameObject.FindGameObjectWithTag ("Player");
        shootScript = me.GetComponent<Shoot>();
        //controller = me.GetComponent<MonoBehaviour>("ThirdPersonController");
    }
Пример #8
0
    void Awake()
    {
        if (instance == null)
            instance = this;
        else if (instance != null)
            Destroy (gameObject);

        _Pool = GetComponent<ObjectPool> ();
        _Spawner = transform.FindChild ("Bullet Spawner");
    }
	// Initialize important variables such as rigidBody and ground and ceiling checks
	void Awake () {
		// score = 0;
		anim = GetComponent<Animator>();
		shotScript = GetComponent<Shoot>();
		health = maxHealth;
		facingRight = true;
		player_RB = GetComponent<Rigidbody2D> ();
		//groundCheck = transform.Find ("GroundCheck");
		ceilingCheck = transform.Find ("CeilingCheck");
		GameController.GetController().ShowLifes (lifes);
	}
Пример #10
0
 // Use this for initialization
 void Awake()
 {
     if (!testing) {
         data = GameObject.Find ("GameData").GetComponent<GameData> ();
         solo = data.alone;
         if(p1)
             data.CheckPlayers ();
     }
     playerShoot = GetComponent<Shoot> ();
     numControllers = Input.GetJoystickNames().Length;
     Debug.Log (numControllers);
     Cursor.visible = false;
 }
Пример #11
0
 void Awake()
 {
     S = this;
     EFFECT_DEFS = new Dictionary<Cube.CubeEffect_e, EffectDefinition>();
     foreach (EffectDefinition def in cubeEffectDefinitions) {
         EFFECT_DEFS[def.effect] = def;
     }
     mainCamera = Camera.main;
     caneEnd = mainCamera.transform.GetChild(0).GetChild(1);
     projectileIndex = 0;
     chargingOutline = GameObject.Find ("ChargingOutline");
     player = GetComponent<PlayerScript>();
     audioSource = GetComponent<AudioSource>();
 }
Пример #12
0
    void ReplaceAnimation(Shoot.BulletInfo hit)
    {
        // Activate and position ragdoll
        _ragDoll.SetActive (true);
        _ragDoll.transform.position = _transform.position;
        _ragDoll.transform.rotation = _transform.rotation;

        // Position the skeletal components of the new rag doll
        TakeSkeletalPositions(_ragDollSkeleton);

        // Find current velocity of drone
        Vector3 currentVelocity = (_transform.position - _lastPosition)/Time.deltaTime;

        // Give new ragdoll the velocity of the drone + a little extra velocity so it looks good
        _ragDoll.transform.FindChild("Root").rigidbody.velocity = currentVelocity * 5;

        // Remove the drone
        gameObject.SetActive(false);

        // Apply bullet force to impact location
        BulletImpact (hit.ray, hit.force);
    }
Пример #13
0
 protected void Awake()
 {
     shoot = GetComponent<Shoot>();
 }
Пример #14
0
 void Start()
 {
     player = gameObject.GetComponent <PlayerMovement>();
     shoot  = gameObject.GetComponent <Shoot>();
 }
Пример #15
0
        /// <inheritdoc />
        public override async Task GetShot(Guid gameId, string __, IReadOnlyBoard board, Shoot shoot)
        {
            BoardIndex ix;

            if (LastShot == null)
            {
                // Player did not shoot before
                ix = new BoardIndex();
            }
            else
            {
                // Player did shoot before. Take location of last shot and increment it by one.
                ix = (BoardIndex)LastShot;
                ix++;
            }

            // Shoot at current square
            await shoot(ix);
        }
 // Use this for initialization
 void Start()
 {
     shoot = GetComponent<Shoot>();
     myPlayerColor = GetComponent<PlayerColor>();
 }
Пример #17
0
 // Use this for initialization
 void Start()
 {
     tw = GetComponent<Shoot> ();
 }
    // Use this for initialization
    void Start()
    {
        playerObject = GameObject.FindGameObjectWithTag("Player");
        thisRigidbody = this.GetComponent<Rigidbody2D>();
        //audioManager = GameObject.FindGameObjectWithTag("SoundManager").GetComponent<SoundManager>();

        foreach(Transform child in transform)
        {
            shoot += child.GetComponent<WeaponControl>().FireCall;
        }
    }
Пример #19
0
 public void Start()
 {
     _shootScript = GetComponent<Shoot>();
 }
Пример #20
0
    void OnGUI()
    {
        DefineStyles();

        //		buttonStyle.fixedWidth = healthBoxWidth;
        //		buttonStyle.fixedHeight = healthBoxHeight;
        //		//health displays
        //		float p1HealthBox = (Screen.width / 4) - (healthBoxWidth / 2);
        //		float p2HealthBox = ((Screen.width / 4) * 3) - (healthBoxHeight / 2);

        //		string health1Text = "Health: " + (Mathf.Floor (p1hp)).ToString ();
        //		GUI.Box (new Rect (p1HealthBox, 0, healthBoxWidth, healthBoxHeight), health1Text, buttonStyle);
        //
        //		string health2Text = "Health: " + (Mathf.Floor (p2hp)).ToString ();
        //		GUI.Box (new Rect (p2HealthBox, 0, healthBoxWidth, healthBoxHeight), health2Text, buttonStyle);



        //powerup heading
        float p1PowerupHeading = 0;
        float p2PowerupHeading = 0.5f;

        //string powerupText = "Powerups";
        //GUI.Box (new Rect (p1PowerupHeading, 0, powerUpHeadingWidth, powerUpHeadingHeight), powerupText, buttonStyle);



        /*
         * Heart health stuff
         * And melee stuff
         */

        //for redundancy
        p1      = GameObject.FindGameObjectWithTag("P1Hit").GetComponent("PlayerController") as PlayerController;
        p2      = GameObject.FindGameObjectWithTag("P2Hit").GetComponent("PlayerController") as PlayerController;
        p1Shoot = GameObject.FindGameObjectWithTag("BSpawnP1").GetComponent("Shoot") as Shoot;
        p2Shoot = GameObject.FindGameObjectWithTag("BSpawnP2").GetComponent("Shoot") as Shoot;

        Texture2D heartImage  = Resources.Load <Texture2D> ("heart_full_32x32_1");
        Texture2D fistImage   = Resources.Load <Texture2D> ("fist");
        Texture2D sledgeImage = Resources.Load <Texture2D> ("sledgehammer");
        Texture2D maceImage   = Resources.Load <Texture2D> ("mace");

        float heartBoxDimensions = ((Screen.width / 3.8f) / 10f);

        healthHeartStyle.fixedWidth  = heartBoxDimensions;
        healthHeartStyle.fixedHeight = heartBoxDimensions;

        /*
         * Player 1 health/melee
         */

        //pistol stuff
        float heart1  = 10;
        float health1 = heart1 + heartBoxDimensions;

        //fist stuff
        float fist1 = heartBoxDimensions * 3;

        //sledge stuff
        float sledge1 = fist1 + heartBoxDimensions + 10;

        //mace stuff
        float mace1 = sledge1 + heartBoxDimensions + 60;


        //health
        GUI.DrawTexture((new Rect(heart1, 0, heartBoxDimensions, heartBoxDimensions)),
                        heartImage, ScaleMode.ScaleToFit, true, 0f);
        string healthText = (Mathf.Floor(p1.hp)).ToString();

        if (GUI.Button(new Rect(health1, 0,
                                heartBoxDimensions, heartBoxDimensions), healthText, buttonStyle))
        {
        }

        //melee
        //		string meleeText = "Melee: Fists";
        //		if(p1.pow == 0){
        //			meleeText = "Melee: Fists";
        //		}else if(p1.pow == 1){
        //			meleeText = "Melee: Sledgefists";
        //		}else if (p1.pow == 2){
        //			meleeText = "Melee: Macefists";
        //		}
        //
        //
        //		if (GUI.Button (new Rect (heartBoxDimensions * 4, 0,
        //		                          1000, heartBoxDimensions), meleeText, buttonStyle)) {
        //		}

        //		//fist
        //		GUI.DrawTexture ((new Rect (fist1, 0, heartBoxDimensions, heartBoxDimensions)),
        //		                 fistImage, ScaleMode.ScaleToFit, true, 0f);
        //
        //		//sledgehammer
        //		GUI.DrawTexture ((new Rect (sledge1, -20, heartBoxDimensions * 3, heartBoxDimensions * 3)),
        //		                 sledgeImage, ScaleMode.ScaleToFit, true, 0f);
        //
        //		//mace
        //		GUI.DrawTexture ((new Rect (mace1, 0, heartBoxDimensions * 2, heartBoxDimensions)),
        //		                 maceImage, ScaleMode.ScaleToFit, true, 0f);



        /*
         * Player 2 health/melee
         */
        //health hearts player 2sq
        //pistol stuff
        float heart12  = 10 + (Screen.width / 2);
        float health12 = heart12 + heartBoxDimensions;

        //fist stuff
        float fist12 = heartBoxDimensions * 3 + (Screen.width / 2);

        //sledge stuff
        float sledge12 = fist12 + heartBoxDimensions + 10;

        //mace stuff
        float mace12 = sledge12 + heartBoxDimensions + 60;


        //health
        GUI.DrawTexture((new Rect(heart12, 0, heartBoxDimensions, heartBoxDimensions)),
                        heartImage, ScaleMode.ScaleToFit, true, 0f);
        healthText = (Mathf.Floor(p2.hp)).ToString();
        if (GUI.Button(new Rect(health12, 0,
                                heartBoxDimensions, heartBoxDimensions), healthText, buttonStyle))
        {
        }

        //		//fist
        //		GUI.DrawTexture ((new Rect (fist12, 0, heartBoxDimensions * 2, heartBoxDimensions)),
        //		                 fistImage, ScaleMode.ScaleToFit, true, 0f);
        //
        //		//sledgehammer
        //		GUI.DrawTexture ((new Rect (sledge12, -20, heartBoxDimensions * 3, heartBoxDimensions * 3)),
        //		                 sledgeImage, ScaleMode.ScaleToFit, true, 0f);
        //
        //		//mace
        //		GUI.DrawTexture ((new Rect (mace12, 0, heartBoxDimensions * 2, heartBoxDimensions)),
        //		                 maceImage, ScaleMode.ScaleToFit, true, 0f);



        /*
         * Weapon stuff
         *
         */


        Texture2D bulletammo = Resources.Load <Texture2D> ("pistol");

        Texture2D drocket_ammo = Resources.Load <Texture2D> ("rocket");
        Texture2D crocket_ammo = Resources.Load <Texture2D> ("rocket_gray");

        Texture2D dshotgun_ammo = Resources.Load <Texture2D> ("shotgun");
        Texture2D cshotgun_ammo = Resources.Load <Texture2D> ("shotgun_gray");

        Texture2D dmissile_ammo = Resources.Load <Texture2D> ("airstrike");
        Texture2D cmissile_ammo = Resources.Load <Texture2D> ("airstrike_gray");



        float weaponBoxDimensions = ((Screen.width / 3.8f) / 10f);


        /*
         * Player 1 weapons
         */

        //pistol stuff
        float weap1 = 10;
        float ammo1 = weap1 + weaponBoxDimensions;

        //rocket stuff
        float weap2 = ammo1 + (weaponBoxDimensions * 1.5f);
        float ammo2 = weap2 + weaponBoxDimensions;

        //shotgun stuff
        float weap3 = ammo2 + (weaponBoxDimensions * 1.5f);
        float ammo3 = weap3 + weaponBoxDimensions;

        //missile stuff
        float weap4 = ammo3 + (weaponBoxDimensions * 1.5f);
        float ammo4 = weap4 + weaponBoxDimensions;

        //row 1 stuff
        float toprow    = 45 + 77;
        float bottomrow = 77 - 10;


        //weapon highlight stuff
        Texture2D weapselect = Resources.Load <Texture2D> ("weapon_cursor_r");

        float selectplace = weap1 - 15;

        if (p1Shoot.ammonum == 0)
        {
            selectplace = weap1 - 11f;
        }
        else if (p1Shoot.ammonum == 1)
        {
            selectplace = weap2 - 11f;
        }
        else if (p1Shoot.ammonum == 2)
        {
            selectplace = weap3 - 11f;
        }
        else if (p1Shoot.ammonum == 3)
        {
            selectplace = weap4 - 11f;
        }
        GUI.DrawTexture((new Rect(selectplace, toprow - 65, heartBoxDimensions * 2.5f, heartBoxDimensions * 2.5f)),
                        weapselect, ScaleMode.ScaleToFit, true, 0f);


        //bullet
        GUI.DrawTexture((new Rect(weap1, (bottomrow + toprow) / 2, weaponBoxDimensions, weaponBoxDimensions)),
                        bulletammo, ScaleMode.ScaleToFit, true, 0f);

        string ammo1Text = (Mathf.Floor(p1Shoot.bullet)).ToString();

        if (GUI.Button(new Rect(ammo1, (bottomrow + toprow) / 2,
                                weaponBoxDimensions, weaponBoxDimensions), ammo1Text, buttonStyle))
        {
        }



        //crocket
        GUI.DrawTexture((new Rect(weap2, toprow, weaponBoxDimensions, weaponBoxDimensions)),
                        crocket_ammo, ScaleMode.ScaleToFit, true, 0f);

        ammo1Text = (Mathf.Floor(p1Shoot.crocket)).ToString();
        if (GUI.Button(new Rect(ammo2, toprow,
                                weaponBoxDimensions, weaponBoxDimensions), ammo1Text, buttonStyle))
        {
        }

        //drocket
        GUI.DrawTexture((new Rect(weap2, bottomrow, weaponBoxDimensions, weaponBoxDimensions)),
                        drocket_ammo, ScaleMode.ScaleToFit, true, 0f);

        ammo1Text = (Mathf.Floor(p1Shoot.rocket)).ToString();
        if (GUI.Button(new Rect(ammo2, bottomrow,
                                weaponBoxDimensions, weaponBoxDimensions), ammo1Text, buttonStyle))
        {
        }



        //cshotgun
        GUI.DrawTexture((new Rect(weap3, toprow, weaponBoxDimensions, weaponBoxDimensions)),
                        cshotgun_ammo, ScaleMode.ScaleToFit, true, 0f);

        ammo1Text = (Mathf.Floor(p1Shoot.cshotgun)).ToString();
        if (GUI.Button(new Rect(ammo3, toprow,
                                weaponBoxDimensions, weaponBoxDimensions), ammo1Text, buttonStyle))
        {
        }

        //dshotgun
        GUI.DrawTexture((new Rect(weap3, bottomrow, weaponBoxDimensions, weaponBoxDimensions)),
                        dshotgun_ammo, ScaleMode.ScaleToFit, true, 0f);

        ammo1Text = (Mathf.Floor(p1Shoot.shotgun)).ToString();
        if (GUI.Button(new Rect(ammo3, bottomrow,
                                weaponBoxDimensions, weaponBoxDimensions), ammo1Text, buttonStyle))
        {
        }


        //cmissile
        GUI.DrawTexture((new Rect(weap4, toprow, weaponBoxDimensions, weaponBoxDimensions)),
                        cmissile_ammo, ScaleMode.ScaleToFit, true, 0f);

        ammo1Text = (Mathf.Floor(p1Shoot.cmissile)).ToString();
        if (GUI.Button(new Rect(ammo4, toprow,
                                weaponBoxDimensions, weaponBoxDimensions), ammo1Text, buttonStyle))
        {
        }

        //dmissile
        GUI.DrawTexture((new Rect(weap4, bottomrow, weaponBoxDimensions, weaponBoxDimensions)),
                        dmissile_ammo, ScaleMode.ScaleToFit, true, 0f);

        ammo1Text = (Mathf.Floor(p1Shoot.missile)).ToString();
        if (GUI.Button(new Rect(ammo4, bottomrow,
                                weaponBoxDimensions, weaponBoxDimensions), ammo1Text, buttonStyle))
        {
        }



        /*
         * Player 2 weapons
         */

        //pistol stuff
        float weap12 = 10 + (Screen.width / 2);
        float ammo12 = weap12 + weaponBoxDimensions;

        //rocket stuff
        float weap22 = ammo12 + (weaponBoxDimensions * 1.5f);
        float ammo22 = weap22 + weaponBoxDimensions;

        //shotgun stuff
        float weap32 = ammo22 + (weaponBoxDimensions * 1.5f);
        float ammo32 = weap32 + weaponBoxDimensions;

        //missile stuff
        float weap42 = ammo32 + (weaponBoxDimensions * 1.5f);
        float ammo42 = weap42 + weaponBoxDimensions;

        //row 1 stuff
        toprow    = 45 + 77;
        bottomrow = 77 - 10;

        //weapon highlight stuff
        weapselect = Resources.Load <Texture2D> ("weapon_cursor_r");

        selectplace = weap12 - 15;
        if (p2Shoot.ammonum == 0)
        {
            selectplace = weap12 - 11f;
        }
        else if (p2Shoot.ammonum == 1)
        {
            selectplace = weap22 - 11f;
        }
        else if (p2Shoot.ammonum == 2)
        {
            selectplace = weap32 - 11f;
        }
        else if (p2Shoot.ammonum == 3)
        {
            selectplace = weap42 - 11f;
        }
        GUI.DrawTexture((new Rect(selectplace, toprow - 65, heartBoxDimensions * 2.5f, heartBoxDimensions * 2.5f)),
                        weapselect, ScaleMode.ScaleToFit, true, 0f);

        //bullet
        GUI.DrawTexture((new Rect(weap12, (bottomrow + toprow) / 2, weaponBoxDimensions, weaponBoxDimensions)),
                        bulletammo, ScaleMode.ScaleToFit, true, 0f);

        ammo1Text = (Mathf.Floor(p2Shoot.bullet)).ToString();
        if (GUI.Button(new Rect(ammo12, (bottomrow + toprow) / 2,
                                weaponBoxDimensions, weaponBoxDimensions), ammo1Text, buttonStyle))
        {
        }



        //crocket
        GUI.DrawTexture((new Rect(weap22, toprow, weaponBoxDimensions, weaponBoxDimensions)),
                        crocket_ammo, ScaleMode.ScaleToFit, true, 0f);

        ammo1Text = (Mathf.Floor(p2Shoot.crocket)).ToString();
        if (GUI.Button(new Rect(ammo22, toprow,
                                weaponBoxDimensions, weaponBoxDimensions), ammo1Text, buttonStyle))
        {
        }

        //drocket
        GUI.DrawTexture((new Rect(weap22, bottomrow, weaponBoxDimensions, weaponBoxDimensions)),
                        drocket_ammo, ScaleMode.ScaleToFit, true, 0f);

        ammo1Text = (Mathf.Floor(p2Shoot.rocket)).ToString();
        if (GUI.Button(new Rect(ammo22, bottomrow,
                                weaponBoxDimensions, weaponBoxDimensions), ammo1Text, buttonStyle))
        {
        }



        //cshotgun
        GUI.DrawTexture((new Rect(weap32, toprow, weaponBoxDimensions, weaponBoxDimensions)),
                        cshotgun_ammo, ScaleMode.ScaleToFit, true, 0f);

        ammo1Text = (Mathf.Floor(p2Shoot.cshotgun)).ToString();
        if (GUI.Button(new Rect(ammo32, toprow,
                                weaponBoxDimensions, weaponBoxDimensions), ammo1Text, buttonStyle))
        {
        }

        //dshotgun
        GUI.DrawTexture((new Rect(weap32, bottomrow, weaponBoxDimensions, weaponBoxDimensions)),
                        dshotgun_ammo, ScaleMode.ScaleToFit, true, 0f);

        ammo1Text = (Mathf.Floor(p2Shoot.shotgun)).ToString();
        if (GUI.Button(new Rect(ammo32, bottomrow,
                                weaponBoxDimensions, weaponBoxDimensions), ammo1Text, buttonStyle))
        {
        }


        //cmissile
        GUI.DrawTexture((new Rect(weap42, toprow, weaponBoxDimensions, weaponBoxDimensions)),
                        cmissile_ammo, ScaleMode.ScaleToFit, true, 0f);

        ammo1Text = (Mathf.Floor(p2Shoot.cmissile)).ToString();
        if (GUI.Button(new Rect(ammo42, toprow,
                                weaponBoxDimensions, weaponBoxDimensions), ammo1Text, buttonStyle))
        {
        }

        //dmissile
        GUI.DrawTexture((new Rect(weap42, bottomrow, weaponBoxDimensions, weaponBoxDimensions)),
                        dmissile_ammo, ScaleMode.ScaleToFit, true, 0f);

        ammo1Text = (Mathf.Floor(p2Shoot.missile)).ToString();
        if (GUI.Button(new Rect(ammo42, bottomrow,
                                weaponBoxDimensions, weaponBoxDimensions), ammo1Text, buttonStyle))
        {
        }



        //		p1Shoot = GameObject.FindGameObjectWithTag ("BSpawnP1").GetComponent ("Shoot") as Shoot;
        //
        //
        //		int weaponTopLeft = 40;

        //		GUIStyle cBox = new GUIStyle (GUI.skin.box);
        //		cBox.normal.background = Resources.Load<Texture2D> ("redbg");
        //		cBox.fixedWidth = 100;
        //		GUI.Box (new Rect (weaponBoxDimensions + 10, weaponTopLeft, 1, 1), "", cBox);

        /*
         * GUI.color = Color.white;
         * //bullet stuff
         * if (p1Shoot.ammonum == 0) {
         *      int boxWidth = 120;
         *      int boxHeight = 30;
         * //			GUI.DrawTexture ((new Rect ((weaponBoxDimensions) + 10, 64, weaponBoxDimensions, weaponBoxDimensions)),
         * //							                 bulletammo, ScaleMode.ScaleToFit, true, 0f);
         * //
         * //			string ammo1Text = (Mathf.Floor (p1Shoot.bullet)).ToString ();
         * //			if (GUI.Button (new Rect ((weaponBoxDimensions) + 10 + weaponBoxDimensions, 64,
         * //			                          weaponBoxDimensions, weaponBoxDimensions), ammo1Text, buttonStyle)) {
         * //						}
         *
         * //			for (int h = 0; h < p1Shoot.bullet; h++) {
         * ////				GUI.DrawTexture ((new Rect ((h * weaponBoxDimensions) + 10, 64, weaponBoxDimensions, weaponBoxDimensions)),
         * ////				                 bulletammo, ScaleMode.ScaleToFit, true, 0f);
         * //
         * ////				if (GUI.Button((new Rect ((h * weaponBoxDimensions) + 10, 64, weaponBoxDimensions, weaponBoxDimensions)), bulletammo)){
         * ////
         * ////				}
         * //
         * //				//GUI.Label((new Rect ((h * weaponBoxDimensions) + 10, 64, weaponBoxDimensions, weaponBoxDimensions)), bulletammo);
         * //
         * //			}
         *
         *      //rocket stuff
         * } else if (p1Shoot.ammonum == 1) {
         *
         * //			GUI.DrawTexture ((new Rect ((weaponBoxDimensions) + 10 + weaponBoxDimensions, 64, weaponBoxDimensions, weaponBoxDimensions)),
         * //			                 crocket_ammo, ScaleMode.ScaleToFit, true, 0f);
         * //
         * //			string ammo1Text = (Mathf.Floor (p1Shoot.crocket)).ToString ();
         * //			if (GUI.Button (new Rect ((weaponBoxDimensions) + 10 + weaponBoxDimensions + weaponBoxDimensions, 64,
         * //			                          weaponBoxDimensions, weaponBoxDimensions), ammo1Text, buttonStyle)) {
         * //			}
         *
         * int rowLength = 5;
         * //			//destruction rocket
         * //			for (int h = 0; h < p1Rocket; h++) {
         * //
         * //				if (h < rowLength) {
         * //					GUI.DrawTexture ((new Rect ((h * weaponBoxDimensions) + 10, weaponTopLeft,
         * //					                            weaponBoxDimensions, weaponBoxDimensions)),
         * //					                 drocket_ammo, ScaleMode.ScaleToFit, true, 0f);
         * //				} else {
         * //					GUI.DrawTexture ((new Rect (((h - rowLength) * weaponBoxDimensions) + 10, weaponTopLeft + 32,
         * //					                            weaponBoxDimensions, weaponBoxDimensions)),
         * //					                 drocket_ammo, ScaleMode.ScaleToFit, true, 0f);
         * //				}
         * //
         * //			}
         *
         *
         *      //construction rocket
         *      for (int h = 0; h < p1CRocket; h++) {
         *
         *              if (h < rowLength) {
         *                      GUI.DrawTexture ((new Rect ((h * weaponBoxDimensions) + (rowLength * weaponBoxDimensions) + 30, weaponTopLeft,
         *                                                  weaponBoxDimensions, weaponBoxDimensions)),
         *                                       crocket_ammo, ScaleMode.ScaleToFit, true, 0f);
         *              } else {
         *                      GUI.DrawTexture ((new Rect (((h - rowLength) * weaponBoxDimensions) + (rowLength * weaponBoxDimensions) + 30, weaponTopLeft + 32,
         *                                                  weaponBoxDimensions, weaponBoxDimensions)),
         *                                       crocket_ammo, ScaleMode.ScaleToFit, true, 0f);
         *              }
         *
         *      }
         *
         *      //shotgun stuff
         * } else if (p1Shoot.ammonum == 2) {
         *
         *      int rowLength = 5;
         *      //destruction shotgun
         *      for (int h = 0; h < p1Shotgun; h++) {
         *
         *              if (h < rowLength) {
         *                      GUI.DrawTexture ((new Rect ((h * weaponBoxDimensions) + 10, weaponTopLeft,
         *                                                  weaponBoxDimensions, weaponBoxDimensions)),
         *                                       dshotgun_ammo, ScaleMode.ScaleToFit, true, 0f);
         *              } else {
         *                      GUI.DrawTexture ((new Rect (((h - rowLength) * weaponBoxDimensions) + 10, weaponTopLeft + 32,
         *                                                  weaponBoxDimensions, weaponBoxDimensions)),
         *                                       dshotgun_ammo, ScaleMode.ScaleToFit, true, 0f);
         *              }
         *
         *      }
         *
         *
         *      //construction shotgun
         *      for (int h = 0; h < p1CShotgun; h++) {
         *
         *              if (h < rowLength) {
         *                      GUI.DrawTexture ((new Rect ((h * weaponBoxDimensions) + (rowLength * weaponBoxDimensions) + 30, weaponTopLeft,
         *                                                  weaponBoxDimensions, weaponBoxDimensions)),
         *                                       cshotgun_ammo, ScaleMode.ScaleToFit, true, 0f);
         *              } else {
         *                      GUI.DrawTexture ((new Rect (((h - rowLength) * weaponBoxDimensions) + (rowLength * weaponBoxDimensions) + 30, weaponTopLeft + 32,
         *                                                  weaponBoxDimensions, weaponBoxDimensions)),
         *                                       cshotgun_ammo, ScaleMode.ScaleToFit, true, 0f);
         *              }
         *
         *      }
         *
         * } else if (p1Shoot.ammonum == 3) {
         *
         *      int rowLength = 5;
         *      //destruction airstrike
         *      for (int h = 0; h < p1Missile; h++) {
         *
         *              if (h < rowLength) {
         *                      GUI.DrawTexture ((new Rect ((h * weaponBoxDimensions) + 10, weaponTopLeft,
         *                                                  weaponBoxDimensions, weaponBoxDimensions)),
         *                                       cmissile_ammo, ScaleMode.ScaleToFit, true, 0f);
         *              } else {
         *                      GUI.DrawTexture ((new Rect (((h - rowLength) * weaponBoxDimensions) + 10, weaponTopLeft + 32,
         *                                                  weaponBoxDimensions, weaponBoxDimensions)),
         *                                       cmissile_ammo, ScaleMode.ScaleToFit, true, 0f);
         *              }
         *
         *      }
         *
         *
         *      //construction airstrike
         *      for (int h = 0; h < p1CMissile; h++) {
         *
         *              if (h < rowLength) {
         *                      GUI.DrawTexture ((new Rect ((h * weaponBoxDimensions) + (rowLength * weaponBoxDimensions) + 30, weaponTopLeft,
         *                                                  weaponBoxDimensions, weaponBoxDimensions)),
         *                                       dmissile_ammo, ScaleMode.ScaleToFit, true, 0f);
         *              } else {
         *                      GUI.DrawTexture ((new Rect (((h - rowLength) * weaponBoxDimensions) + (rowLength * weaponBoxDimensions) + 30, weaponTopLeft + 32,
         *                                                  weaponBoxDimensions, weaponBoxDimensions)),
         *                                       dmissile_ammo, ScaleMode.ScaleToFit, true, 0f);
         *              }
         *
         *      }
         *
         *
         * }
         */



        /*
         * Player 2 weapon stuff
         */
        //		weaponTopLeft = 40;
        //
        //		//		GUIStyle cBox = new GUIStyle (GUI.skin.box);
        //		//		cBox.normal.background = Resources.Load<Texture2D> ("redbg");
        //		//		cBox.fixedWidth = 100;
        //		//		GUI.Box (new Rect (weaponBoxDimensions + 10, weaponTopLeft, 1, 1), "", cBox);
        //
        //		p2Shoot = GameObject.FindGameObjectWithTag ("BSpawnP2").GetComponent ("Shoot") as Shoot;
        //
        //		GUI.color = Color.white;
        //		//bullet stuff
        //		if (p2Shoot.ammonum == 0) {
        //			for (int h = 0; h < p2Bullet; h++) {
        //				GUI.DrawTexture ((new Rect ((h * weaponBoxDimensions) + (Screen.width / 2) + 10, 64, weaponBoxDimensions, weaponBoxDimensions)),
        //				                 bulletammo, ScaleMode.ScaleToFit, true, 0f);
        //
        //			}
        //
        //			//rocket stuff
        //		} else if (p2Shoot.ammonum == 1) {
        ////			GUI.DrawTexture ((new Rect ((weaponBoxDimensions) + (Screen.width / 2) + 10, weaponTopLeft,
        ////			                            weaponBoxDimensions, weaponBoxDimensions)),
        ////			                 drocket_ammo, ScaleMode.ScaleToFit, true, 0f);
        //
        //
        //			//Debug.Log (p2Shoot.ammonum);
        //			int rowLength = 5;
        //			//destruction rocket
        //			for (int g = 0; g < p2Rocket; g++) {
        //
        //				if (g < rowLength) {
        //					GUI.DrawTexture ((new Rect ((g * weaponBoxDimensions) + (Screen.width / 2) + 10, weaponTopLeft,
        //					                            weaponBoxDimensions, weaponBoxDimensions)),
        //					                 drocket_ammo, ScaleMode.ScaleToFit, true, 0f);
        //				} else {
        //					GUI.DrawTexture ((new Rect (((g - rowLength) * weaponBoxDimensions) + (Screen.width / 2) + 10, weaponTopLeft + 32,
        //					                            weaponBoxDimensions, weaponBoxDimensions)),
        //					                 drocket_ammo, ScaleMode.ScaleToFit, true, 0f);
        //				}
        //
        //			}
        //
        //
        //			//construction rocket
        //			for (int h = 0; h < p2CRocket; h++) {
        //
        //				if (h < rowLength) {
        //					GUI.DrawTexture ((new Rect ((h * weaponBoxDimensions) + (rowLength * weaponBoxDimensions) + 30 + (Screen.width / 2), weaponTopLeft,
        //					                            weaponBoxDimensions, weaponBoxDimensions)),
        //					                 crocket_ammo, ScaleMode.ScaleToFit, true, 0f);
        //				} else {
        //					GUI.DrawTexture ((new Rect (((h - rowLength) * weaponBoxDimensions) + (rowLength * weaponBoxDimensions) + 30 + (Screen.width / 2), weaponTopLeft + 32,
        //					                            weaponBoxDimensions, weaponBoxDimensions)),
        //					                 crocket_ammo, ScaleMode.ScaleToFit, true, 0f);
        //				}
        //
        //			}
        //
        //			//shotgun stuff
        //		} else if (p2Shoot.ammonum == 2) {
        //
        //			int rowLength = 5;
        //			//destruction shotgun
        //			for (int h = 0; h < p2Shotgun; h++) {
        //
        //				if (h < rowLength) {
        //					GUI.DrawTexture ((new Rect ((h * weaponBoxDimensions) + 10 + (Screen.width / 2), weaponTopLeft,
        //					                            weaponBoxDimensions, weaponBoxDimensions)),
        //					                 dshotgun_ammo, ScaleMode.ScaleToFit, true, 0f);
        //				} else {
        //					GUI.DrawTexture ((new Rect (((h - rowLength) * weaponBoxDimensions) + 10 + (Screen.width / 2), weaponTopLeft + 32,
        //					                            weaponBoxDimensions, weaponBoxDimensions)),
        //					                 dshotgun_ammo, ScaleMode.ScaleToFit, true, 0f);
        //				}
        //
        //			}
        //
        //
        //			//construction shotgun
        //			for (int h = 0; h < p2CShotgun; h++) {
        //
        //				if (h < rowLength) {
        //					GUI.DrawTexture ((new Rect ((h * weaponBoxDimensions) + (rowLength * weaponBoxDimensions) + 30 + (Screen.width / 2), weaponTopLeft,
        //					                            weaponBoxDimensions, weaponBoxDimensions)),
        //					                 cshotgun_ammo, ScaleMode.ScaleToFit, true, 0f);
        //				} else {
        //					GUI.DrawTexture ((new Rect (((h - rowLength) * weaponBoxDimensions) + (rowLength * weaponBoxDimensions) + 30 + (Screen.width / 2), weaponTopLeft + 32,
        //					                            weaponBoxDimensions, weaponBoxDimensions)),
        //					                 cshotgun_ammo, ScaleMode.ScaleToFit, true, 0f);
        //				}
        //
        //			}
        //
        //		}else if (p2Shoot.ammonum == 3) {
        //
        //			int rowLength = 5;
        //			//destruction airstrike
        //			for (int h = 0; h < p2Missile; h++) {
        //
        //				if (h < rowLength) {
        //					GUI.DrawTexture ((new Rect ((h * weaponBoxDimensions) + 10 + (Screen.width / 2), weaponTopLeft,
        //					                            weaponBoxDimensions, weaponBoxDimensions)),
        //					                 cmissile_ammo, ScaleMode.ScaleToFit, true, 0f);
        //				} else {
        //					GUI.DrawTexture ((new Rect (((h - rowLength) * weaponBoxDimensions) + 10 + (Screen.width / 2), weaponTopLeft + 32,
        //					                            weaponBoxDimensions, weaponBoxDimensions)),
        //					                 cmissile_ammo, ScaleMode.ScaleToFit, true, 0f);
        //				}
        //
        //			}
        //
        //
        //			//construction airstrike
        //			for (int h = 0; h < p2CMissile; h++) {
        //
        //				if (h < rowLength) {
        //					GUI.DrawTexture ((new Rect ((h * weaponBoxDimensions) + (rowLength * weaponBoxDimensions) + 30 + (Screen.width / 2), weaponTopLeft,
        //					                            weaponBoxDimensions, weaponBoxDimensions)),
        //					                 dmissile_ammo, ScaleMode.ScaleToFit, true, 0f);
        //				} else {
        //					GUI.DrawTexture ((new Rect (((h - rowLength) * weaponBoxDimensions) + (rowLength * weaponBoxDimensions) + 30 + (Screen.width / 2), weaponTopLeft + 32,
        //					                            weaponBoxDimensions, weaponBoxDimensions)),
        //					                 dmissile_ammo, ScaleMode.ScaleToFit, true, 0f);
        //				}
        //
        //			}
        //
        //		}
    }
Пример #21
0
 void Start()
 {
     anim  = GetComponent <Animator>();
     shoot = FindObjectOfType <Shoot>();
 }
Пример #22
0
 public EditAdapter(Activity context, Dictionary <Bootlegger.BootleggerEditStatus, List <Edit> > items, Shoot currentevent)
     : base()
 {
     this.context      = context;
     this.CurrentEvent = currentevent;
     UpdateData(items, false);
 }
Пример #23
0
    // Update is called once per frame
    public void Update()
    {
        Command p1command = null;
        Command p2command = null;

        if (Input.GetAxis("Vertical") < -.25f)
        {
            p1command = new MoveUp();

            p1ActivateCommand(p1command);
        }

        if (Input.GetAxis("Vertical") > .25f)
        {
            p1command = new MoveDown();
            p1ActivateCommand(p1command);
        }
        if (Input.GetAxis("Horizontal") < -.25f)
        {
            p1command = new MoveLeft();
            p1ActivateCommand(p1command);
        }
        if (Input.GetAxis("Horizontal") > .25f)
        {
            p1command = new MoveRight();
            p1ActivateCommand(p1command);
        }
        if (Input.GetButtonDown("switch"))
        {
            p1command = new SwitchWeapon();
            p1ActivateCommand(p1command);
        }

        if (Input.GetButtonDown("Roll"))
        {
            p1command = new Roll();
            p1ActivateCommand(p1command);
        }

        if (Input.GetButtonDown("Shoot"))
        {
            p1command = new Shoot();
            p1ActivateCommand(p1command);
        }

        if (Input.GetAxis("Vertical") > -.75f && Input.GetAxis("Vertical") <= .25f)
        {
            p1command = new WaitUp();
            p1ActivateCommand(p1command);
        }

        if (Input.GetAxis("Vertical") >= -.25f && Input.GetAxis("Vertical") < .75f)
        {
            p1command = new WaitDown();
            p1ActivateCommand(p1command);
        }

        if (Input.GetAxis("Horizontal") > -.75f && Input.GetAxis("Horizontal") <= 25f)
        {
            p1command = new WaitLeft();
            p1ActivateCommand(p1command);
        }

        if (Input.GetAxis("Horizontal") >= -.25f && Input.GetAxis("Horizontal") < .75f)
        {
            p1command = new WaitRight();
            p1ActivateCommand(p1command);
        }


        //////////////////////////////////////P2 = aka, there has to be a better way...

        if (Input.GetAxis("VerticalP2") < -.25f)
        {
            p2command = new MoveUp();
            p2ActivateCommand(p2command);
        }

        if (Input.GetAxis("VerticalP2") > .25f)
        {
            p2command = new MoveDown();
            p2ActivateCommand(p2command);
        }
        if (Input.GetAxis("HorizontalP2") < -.25f)
        {
            p2command = new MoveLeft();
            p2ActivateCommand(p2command);
        }
        if (Input.GetAxis("HorizontalP2") > .25f)
        {
            p2command = new MoveRight();
            p2ActivateCommand(p2command);
        }
        if (Input.GetButtonDown("switchP2"))
        {
            p2command = new SwitchWeapon();
            p2ActivateCommand(p2command);
        }

        if (Input.GetButtonDown("RollP2"))
        {
            p2command = new Roll();
            p2ActivateCommand(p2command);
        }

        if (Input.GetButtonDown("ShootP2"))
        {
            p2command = new Shoot();
            p2ActivateCommand(p2command);
        }

        if (Input.GetAxis("VerticalP2") > -.75f && Input.GetAxis("VerticalP2") <= .25f)
        {
            p2command = new WaitUp();
            p2ActivateCommand(p2command);
        }

        if (Input.GetAxis("VerticalP2") >= -.25f && Input.GetAxis("VerticalP2") < .75f)
        {
            p2command = new WaitDown();
            p2ActivateCommand(p2command);
        }

        if (Input.GetAxis("HorizontalP2") > -.75f && Input.GetAxis("HorizontalP2") <= 25f)
        {
            p2command = new WaitLeft();
            p2ActivateCommand(p2command);
        }

        if (Input.GetAxis("HorizontalP2") >= -.25f && Input.GetAxis("HorizontalP2") < .75f)
        {
            p2command = new WaitRight();
            p2ActivateCommand(p2command);
        }
    }
Пример #24
0
 private Quaternion RecoilM(Transform Camera)
 {
     if (recoil > 0)
     {
         if (Player.WeaponSwap.InformWeapon() == false)
         {
             maxRecoil_x = -50 * Random.Range(1.8f, 3.3f);//一回のリコイル大きさ
             FixTime    += 0.03f;
         }
         else
         {
             maxRecoil_x = -120;
             FixTime    += 0.07f;
         }
         recoil -= Time.deltaTime;
         if (/*recoil < 0 &&*/ !Input.GetKey(KeyCode.Mouse0))
         {
             //Debug.Log("infix");
             fixing = true;
         }
         if (Shoot.InformMagazineLeft() == 0)
         {
             fixing = true;
         }
         Quaternion CameraQuart = new Quaternion(0, 0, 0, 0f);
         Quaternion maxRecoil   = new Quaternion(maxRecoil_x, 0, 0, 0);
         Quaternion nowQuart    = Quaternion.Slerp(CameraQuart, maxRecoil, Time.deltaTime * recoilSpeed);
         return(nowQuart);
     }
     else if (fixing == true)
     {
         recoil      = 0f;
         maxRecoil_x = 0;
         if (fixing == true && PlayerCamera.transform.rotation.x - beforeQuart.x < -0.000001f)
         {
             FixTime -= Time.deltaTime;
             Debug.Log("Fixing");
             Quaternion CameraQuart = new Quaternion(0, 0, 0, 0f);
             Quaternion fixRecoil   = new Quaternion(2.3f, 0, 0, 0);
             if (Player.WeaponSwap.InformWeapon() == false)
             {
                 fixRecoil = new Quaternion(4.3f, 0, 0, 0);
             }
             Quaternion nowQuart = Quaternion.Slerp(CameraQuart, fixRecoil, Time.deltaTime);
             if (0 > FixTime)
             {
                 FixTime = 0f;
                 fixing  = false;
             }
             return(nowQuart);
         }
         else //if(fixing == true && Getkeydown == false)
         {
             Debug.Log("fix end");
             Debug.Log(PlayerCamera.transform.rotation.x - beforeQuart.x);
             FixTime = 0f;
             fixing  = false;
         }
     }
     return(new Quaternion(1000, 0, 0, 0));
 }
 public CircularShootingStrategy(Point startingPioint, Shoot shoot)
 {
 }
Пример #26
0
 void Awake()
 {
     inputState = GetComponent<InputState>();
     shoot = GetComponent<Shoot>();
 }
    void Start()
    {
        targetObject = Instantiate(targetPrefab, topWall.transform.position, Quaternion.identity) as GameObject;
        thisRigidbody = this.GetComponent<Rigidbody2D>();
        SoundManager.singleton.playSustainedSound(bossMusic);
        //audioManager = GameObject.FindGameObjectWithTag("SoundManager").GetComponent<SoundManager>();

        foreach(Transform child in transform)
        {
            shoot += child.GetComponent<WeaponControl>().FireCall;
        }
    }
Пример #28
0
        public async Task <bool> StartBroadcastingBle(Context context, Shoot ev)
        {
            //ask to turn on bluetooth:
            BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.DefaultAdapter;

            var allprefs = context.GetSharedPreferences(WhiteLabelConfig.BUILD_VARIANT.ToLower(), FileCreationMode.Private);
            //var prefs = allprefs.Edit();
            var useble = allprefs.GetBoolean("ble-" + ev.id, true);

            //prefs.PutInt("ble_enable", currentversion);
            //prefs.Apply();
            if (!useble)
            {
                return(false);
            }

            if (mBluetoothAdapter.State == State.Off)
            {
                //ask to turn on:
                TaskCompletionSource <bool> tcs = new TaskCompletionSource <bool>();
                var dialog = new Android.Support.V7.App.AlertDialog.Builder(context);
                dialog.SetTitle(Resource.String.enableble);
                dialog.SetMessage(Resource.String.blemessage);
                dialog.SetPositiveButton(Android.Resource.String.Yes, (o, e) =>
                {
                    tcs.SetResult(true);
                });

                dialog.SetNegativeButton(Android.Resource.String.No, (o, e) =>
                {
                    tcs.SetResult(false);
                });

                dialog.Show();

                var result = await tcs.Task;
                if (result)
                {
                    allprefs.Edit().PutBoolean("ble-" + ev.id, true).Apply();

                    //turn on ble
                    mBluetoothAdapter.Enable();
                    //need to wait for ble event saying its started here:
                    await Task.WhenAny(Task.Delay(3000), Task.Factory.StartNew(() =>
                    {
                        while (mBluetoothAdapter.State != State.On)
                        {
                            Task.Yield();
                        }
                    }));
                }
                else
                {
                    allprefs.Edit().PutBoolean("ble-" + ev.id, false).Apply();
                    return(false);
                }
            }

            var compat = BeaconTransmitter.CheckTransmissionSupported(context);

            if (compat == BeaconTransmitter.Supported)
            {
                try
                {
                    byte[] urlBytes = UrlBeaconUrlCompressor.Compress("https://" + WhiteLabelConfig.BEACONHOST + "/b/");// 91071");//+ev.offlinecode);
                    //HACK: remove line!
                    //ev.offlinecode = "91071";
                    List <byte> bytes = new List <byte>(urlBytes);
                    bytes.AddRange(Encoding.ASCII.GetBytes(ev.offlinecode));

                    urlBytes = bytes.ToArray();

                    Identifier        encodedUrlIdentifier = Identifier.FromBytes(urlBytes, 0, urlBytes.Length, false);
                    List <Identifier> identifiers          = new List <Identifier>();
                    identifiers.Add(encodedUrlIdentifier);
                    beacon = new Beacon.Builder()
                             .SetIdentifiers(identifiers)
                             .SetServiceUuid(0xfeaa)
                             .SetManufacturer(0x0118)
                             .SetBeaconTypeCode(0x10)
                             .SetTxPower(-59)
                             .Build();
                    BeaconParser beaconParser = new BeaconParser().SetBeaconLayout(BeaconParser.EddystoneUrlLayout);

                    beaconTransmitter = new BeaconTransmitter(context, beaconParser);

                    beaconTransmitter.StartAdvertising(beacon, this);
                }
                catch (MalformedURLException)
                {
                    Log.Debug("BOOTLEGGER", "That URL cannot be parsed");
                }
                return(true);
            }
            else
            {
                //not supported
                return(false);
            }
        }
Пример #29
0
    IEnumerator patternFire(int max, Shoot shoot, int spawn = 0)
    {
        while (spawn < max - 1 && bullets[spawn].activeSelf)
        {
            spawn++;
        }

        while (true)
        {
            if (spawn >= max)
                spawn = 0;

            if (bullets[spawn].activeSelf == false)
            {
                if (spawn % 2 == 0)
                {
                    bullets[spawn].transform.position = new Vector3(0, 0, 0);
                    bullets[spawn].SetActive(true);
                    m_Bullets_Script[spawn].play(m_direction);

                    spawn++;
                }
                else
                {
                    bullets[spawn].transform.position = new Vector3(0, 0, 0);
                    bullets[spawn].SetActive(true);
                    m_Bullets_Script[spawn].play(-m_direction);
                    spawn++;
                }
                if (m_direction < 360)
                {
                    if (shoot == Shoot.Double)
                        m_direction += 5;
                    else if (shoot == Shoot.Cross)
                        m_direction += 90;
                    else if (shoot == Shoot.Star)
                        m_direction += 45;
                    else if (shoot == Shoot.Twin)
                        m_direction += 50;
                }
                else
                    m_direction = 0;
            }
            yield return new WaitForSeconds(0.01f);
        }
    }
 private void Awake()
 {
     text  = GetComponent <Text>();
     shoot = GameObject.FindGameObjectWithTag("Player").GetComponent <Shoot>();
 }
Пример #31
0
 void Awake()
 {
     instance = this;
 }
Пример #32
0
    // Use this for initialization
    void Start()
    {
        if (PhotonNetwork.player.GetTeam() == PunTeams.Team.red)
        {
            team = true;
        }
        else
        {
            team = false;
        }


        inventory   = GetComponent <Inventory>();
        shootScript = GetComponent <Shoot>();

        thirdPersonAnimator = GetComponent <Animator> ();
        playerMovement      = GetComponent <PlayerMovement> ();
        weaponDatabase      = FindObjectOfType <WeaponDatabase> ();
        hand     = GameObject.Find("Character1_RightHand").transform;
        leftHand = GameObject.Find("Character1_LeftHand").transform;
        if (currentWeapon == null)
        {
            currentWeapon = weaponDatabase.database [0];
        }



        if (!photonView.isMine)
        {
            reloadWarningPanel = GameObject.Find("ReloadWarningPanel");
            if (GetComponent <PhotonView>().owner.GetTeam() == PunTeams.Team.red)
            {
                myGun.GetComponentInChildren <MeshRenderer>().material.color = Color.red;
            }
            else if (GetComponent <PhotonView>().owner.GetTeam() == PunTeams.Team.blue)
            {
                myGun.GetComponentInChildren <MeshRenderer>().material.color = Color.blue;
            }

            /// AUDIO
            gunShotSFX.spatialBlend = 1f;

            // gunshotfx - parts are on 3rd person, child of shotgun
            muzzleFlash = GetComponentInChildren <Light> ();
            myParts     = GetComponentInChildren <ParticleSystem> ();
        }
        else if (photonView.isMine)
        {
            bulletspawnPoss = GameObject.Find("BulletSpawnPos");
            muzzleFlash     = Camera.main.GetComponentInChildren <Light> ();
            myParts         = Camera.main.GetComponentInChildren <ParticleSystem> ();


            myGun.GetComponentInChildren <MeshRenderer> ().enabled = false;
            reloadWarningPanel = GameObject.Find("ReloadWarningPanel");
            gunAnimator        = Camera.main.transform.Find("WaterPistol_Idle").GetComponent <Animator>();
            ammo         = magSize;
            ammoTxt      = GameObject.Find("AmmoText").GetComponent <Text>();
            ammoTxt.text = ammo.ToString();

            reloadWarningPanel.SetActive(false);
            reloadReset  = reloadTakesSecs;
            reloadSlider = GameObject.Find("ReloadSlider");
            reloadSlider.SetActive(false);

            hitMarker = GameObject.Find("HitMarker");
            hitMarker.GetComponent <Image> ().enabled = false;
        }

        myGun.transform.localScale = Vector3.one;
        StartCoroutine("FuckWaitAss");
    }
 void Start()
 {
     shooter = GameObject.Find("Shooter").GetComponent<Shoot>();
 }
Пример #34
0
 void Awake()
 {
     myPC = GetComponentInParent <Shoot>();
 }
Пример #35
0
 public void Awake()
 {
     shoot = GetComponent <Shoot>();
 }
Пример #36
0
 private void Myclips_OnEventInfoUpdate(Shoot obj)
 {
     FindViewById <TextView>(Resource.Id.contributors).Text  = Java.Lang.String.Format("%d", obj.numberofcontributors);
     FindViewById <TextView>(Resource.Id.contributions).Text = Java.Lang.String.Format("%d", obj.numberofclips);
 }
 public MapFragment(Shoot current, bool noscroll)
 {
     CurrentEvent  = current;
     this.noscroll = noscroll;
 }
Пример #38
0
 private void Awake()
 {
     shoot = FindObjectOfType <Camera>().GetComponent <Shoot>();
 }
Пример #39
0
    // Use this for initialization

    void Start()
    {
        rgb2     = GetComponent <Rigidbody2D>();
        renderer = GetComponent <SpriteRenderer>();
        _shoot   = GameObject.Find("PlayerHead").GetComponent <Shoot>();
    }
Пример #40
0
 void Start()
 {
     PlayerAttribute = GameObject.Find("Player").GetComponent <PlayerAttribute>();
     createAward     = true;
     shoot           = GameObject.Find("Shoot").GetComponent <Shoot>();
 }
Пример #41
0
 public ShootSystem()
 {
     shoot = playerGO.First().GetComponent <Shoot>();
 }
Пример #42
0
    public override void AddWeapon()
    {
        Shoot newShoot = new Shoot();

        base.AddWeapon(newShoot);
    }
Пример #43
0
 void Start()
 {
     characterController = GetComponent<ShipMovement> ();
     shoot = GetComponent<Shoot> ();
     controlType = PlayerPrefs.GetInt("Controls");
 }
Пример #44
0
 void Start()
 {
     S             = GetComponent <Shoot>();
     InitialOffset = transform.localPosition.z;
 }
Пример #45
0
 void Awake()
 {
     Instance = this;
 }
Пример #46
0
 // Start is called before the first frame update
 void Start()
 {
     shootScript = GetComponent <Shoot>();
 }
Пример #47
0
    IEnumerator doubleSpin(int max, Shoot shoot, int spawn = 0)
    {
        bool isright = true;
        while (spawn < max - 1 && bullets[spawn].activeSelf)
        {
            spawn++;
        }
        while (true)
        {

            if (spawn >= max)
                spawn = 0;

            if (bullets[spawn].activeSelf == false)
            {
                //Debug.Log("Fire Changed");
                if (spawn % 2 == 0)
                {
                    bullets[spawn].transform.position = new Vector3(0, 0, 0);
                    bullets[spawn].SetActive(true);
                    m_Bullets_Script[spawn].play(m_direction);

                    spawn++;
                }
                else
                {
                    bullets[spawn].transform.position = new Vector3(0, 0, 0);
                    bullets[spawn].SetActive(true);
                    m_Bullets_Script[spawn].play(m_direction + 30);
                    spawn++;
                }
                if (m_direction < 360 && isright)
                {
                    m_direction += 20;
                }
                else
                {
                    isright = false;
                    m_direction -= 20;
                    if (m_direction < 160)
                        isright = true;
                }
            }
            yield return new WaitForSeconds(0.01f);
        }
    }
Пример #48
0
 private void Start()
 {
     ammo             = GameObject.Find("Ammo_Text").GetComponent <Text>();
     _shoot           = FindObjectOfType <Shoot>();
     _shoot.Shooting += SetAmmoText;
 }
Пример #49
0
 // Use this for initialization
 void Awake()
 {
     tw = GetComponent<Shoot> ();
 }
Пример #50
0
 // Use this for initialization
 void Start()
 {
     this.shoot = new Shoot(bulletPrefab, firePosition.transform, shootingDelay);
     this.shoot.Start();
 }
Пример #51
0
 // Use this for initialization
 void Start()
 {
     me = GameObject.FindGameObjectWithTag ("Player");
     shootScript = me.GetComponent<Shoot>();
 }
Пример #52
0
 private void Awake()
 {
     instance = this;
 }
Пример #53
0
 void Awake()
 {
     shoot = (Shoot)GameObject.Find("Player").GetComponentInChildren(typeof(Shoot));
 }
Пример #54
0
 /// <summary>
 /// Gets the next shot from the player.
 /// </summary>
 /// <param name="gameId">Unique identifier of the current game</param>
 /// <param name="opponent">identifier of the opponent</param>
 /// <param name="board">Current board content</param>
 /// <param name="shoot">Callback with which the method has to do the shooting</param>
 /// <remarks>
 /// <para>
 /// The method has to call <paramref name="shoot"/> exactly once before returning.
 /// </para>
 /// <para>
 /// The method has to finish within 250ms.
 /// </para>
 /// <para>
 /// The method is not expected to throw an exception.
 /// </para>
 /// <para>
 /// Players have to be stateless. During a battle, a new player might be instantiated
 /// at any time, maybe even for every shot. If the player needs state, it has to store
 /// its state externally (e.g. file on disk).
 /// </para>
 /// <para>
 /// The <paramref name="gameId"/> will stay the same during a single game between two players.
 /// </para>
 /// </remarks>
 public abstract Task GetShot(Guid gameId, string opponentId, IReadOnlyBoard board, Shoot shoot);
 void WasShot(Shoot.BulletInfo info)
 {
     MakeParticles(info);
 }
Пример #56
0
 // Start is called before the first frame update
 void Awake()
 {
     rigid2D = GetComponent <Rigidbody2D>();
     shoot   = GetComponent <Shoot>();
 }
Пример #57
0
        private Shoot BeatThis(Shoot opposingPlay)
        {
            Random rng = new Random();

            int coinFlip = rng.Next(0, 2);

            switch (opposingPlay)
            {
                case Shoot.Rock:
                    if (coinFlip == 0)
                        return Shoot.Paper;
                    else
                        return Shoot.Spock;
                    break;

                case Shoot.Paper:
                    if (coinFlip == 0)
                        return Shoot.Scissors;
                    else
                        return Shoot.Lizard;
                    break;

                case Shoot.Scissors:
                    if (coinFlip == 0)
                        return Shoot.Rock;
                    else
                        return Shoot.Spock;
                    break;

                case Shoot.Lizard:
                    if (coinFlip == 0)
                        return Shoot.Rock;
                    else
                        return Shoot.Scissors;
                    break;

                case Shoot.Spock:
                    if (coinFlip == 0)
                        return Shoot.Paper;
                    else
                        return Shoot.Lizard;
                    break;

                default:
                    return 0;
                    break;
            }
        }
Пример #58
0
        //MyPagerAdapter pageadapter;

        protected async override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);


            SetTheme(Resource.Style.Theme_Normal);

            SetContentView(Resource.Layout.Roles_Activity);

            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            // Sets the Toolbar to act as the ActionBar for this Activity window.
            // Make sure the toolbar exists in the activity and is not null
            SetSupportActionBar(toolbar);

            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            Window.ClearFlags(WindowManagerFlags.TranslucentStatus);

            if (Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.Lollipop)
            {
                // add FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS flag to the window
                Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);

                // finally change the color
                Window.SetStatusBarColor(Resources.GetColor(Android.Resource.Color.Transparent));
            }

            //create fragment:

            string id = Intent.Extras?.GetString("id");

            if (!string.IsNullOrEmpty(id))
            {
                //Analytics.TrackEvent("ChooseRole");

                //load event info:
                cancel = new CancellationTokenSource();
                AndHUD.Shared.Show(this, Resources.GetString(Resource.String.connecting), -1, MaskType.Black, null, null, true, () =>
                {
                    cancel.Cancel();
                    Finish();
                });

                try
                {
                    if (!string.IsNullOrEmpty(id))
                    {
                        CurrentEvent = await Bootlegger.BootleggerClient.GetEventInfo(id, cancel.Token);
                    }
                }
                catch (Exception ex)
                {
                    SetResult(Result.FirstUser);
                    Finish();
                    return;
                }
                finally
                {
                    AndHUD.Shared.Dismiss();
                }
            }
            else
            {
                CurrentEvent = Bootlegger.BootleggerClient.CurrentEvent;
            }

            Bootleg.API.Bootlegger.BootleggerClient.LogUserAction("ChooseRole",
                                                                  new KeyValuePair <string, string>("eventid", CurrentEvent.id));

            CollapsingToolbarLayout collapsingToolbar = FindViewById <CollapsingToolbarLayout>(Resource.Id.collapsing_toolbar);

            collapsingToolbar.SetTitle(CurrentEvent.name);
            //collapsingToolbar.SetCollapsedTitleTextColor(Color.Transparent);
            collapsingToolbar.SetExpandedTitleTextAppearance(Resource.Style.ExpandedAppBar);
            Typeface font = ResourcesCompat.GetFont(this, Resource.Font.montserratregular);

            FindViewById <CollapsingToolbarLayout>(Resource.Id.collapsing_toolbar).CollapsedTitleTypeface = font;
            FindViewById <CollapsingToolbarLayout>(Resource.Id.collapsing_toolbar).ExpandedTitleTypeface  = font;

            if (!string.IsNullOrEmpty(CurrentEvent.roleimg))
            {
                FindViewById <AppBarLayout>(Resource.Id.appbar).SetExpanded(false, false);
            }

            //if (!string.IsNullOrEmpty(CurrentEvent.iconbackground) && !WhiteLabelConfig.REDUCE_BANDWIDTH)
            //    Picasso.With(this).Load(CurrentEvent.iconbackground).CenterCrop().Fit().MemoryPolicy(MemoryPolicy.NoCache, MemoryPolicy.NoStore).Into(FindViewById<ImageView>(Resource.Id.defaultback), new Action(() => {
            //        var bitmap = ((BitmapDrawable)FindViewById<ImageView>(Resource.Id.defaultback).Drawable).Bitmap;
            //        Palette palette = Palette.From(bitmap).Generate();
            //        int vibrant = palette.GetLightVibrantColor(0);
            //        if (vibrant == 0)
            //            vibrant = palette.GetMutedColor(0);
            //        int dark = palette.GetVibrantColor(0);
            //        if (dark == 0)
            //            dark = palette.GetLightMutedColor(0);
            //        //FindViewById<CollapsingToolbarLayout>(Resource.Id.collapsing_toolbar).SetContentScrimColor(vibrant);
            //        //FindViewById<CollapsingToolbarLayout>(Resource.Id.collapsing_toolbar).SetStatusBarScrimColor(dark);
            //    }),null);
            //else
            //Picasso.With(this).Load(Resource.Drawable.user_back).CenterCrop().Fit().Into(FindViewById<ImageView>(Resource.Id.defaultback));

            AndHUD.Shared.Dismiss();



            SelectRoleFrag myrole;

            if (bundle == null)
            {
                myrole = new SelectRoleFrag(CurrentEvent, false);
                myrole.OnRoleChanged += Myrole_OnRoleChanged;
                Android.Support.V4.App.FragmentTransaction ft = SupportFragmentManager.BeginTransaction();
                try
                {
                    ft.Add(Resource.Id.roles_frag_holder, myrole, "rolefragment").Commit();
                }
                catch
                {
                    //failed dont know why!
                }
            }
            else
            {
                myrole = SupportFragmentManager.FindFragmentByTag("rolefragment") as SelectRoleFrag;
                myrole.OnRoleChanged += Myrole_OnRoleChanged;
            }
        }
Пример #59
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();
        List <Action> actions = ai.actions;

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.PropertyField(_enum);
        if (GUILayout.Button("+"))
        {
            switch (ai._enum)
            {
            case AI.sta.SimpleFly:
                SimpleFly s = CreateInstance <SimpleFly>();
                id = 0;
                while (AssetDatabase.IsMainAssetAtPathLoaded(path(s)))
                {
                    id++;
                }
                AssetDatabase.CreateAsset(s, path(s));
                AssetDatabase.Refresh();
                actions.Add(s);
                break;

            case AI.sta.Shoot:
                Shoot sh = CreateInstance <Shoot>();
                id = 0;
                while (AssetDatabase.IsMainAssetAtPathLoaded(path(sh)))
                {
                    id++;
                }
                AssetDatabase.CreateAsset(sh, path(sh));
                AssetDatabase.Refresh();
                actions.Add(sh);
                break;

            case AI.sta.RootRandom:
                RootRandom rR = CreateInstance <RootRandom>();
                id = 0;
                while (AssetDatabase.IsMainAssetAtPathLoaded(path(rR)))
                {
                    id++;
                }
                AssetDatabase.CreateAsset(rR, path(rR));
                AssetDatabase.Refresh();
                actions.Add(rR);
                break;

            case AI.sta.HorizontMove:
                HorizontMove hM = CreateInstance <HorizontMove>();
                id = 0;
                while (AssetDatabase.IsMainAssetAtPathLoaded(path(hM)))
                {
                    id++;
                }
                AssetDatabase.CreateAsset(hM, path(hM));
                AssetDatabase.Refresh();
                actions.Add(hM);
                break;

            case AI.sta.PutBomb:
                PutBomb pb = CreateInstance <PutBomb>();
                id = 0;
                while (AssetDatabase.IsMainAssetAtPathLoaded(path(pb)))
                {
                    id++;
                }
                AssetDatabase.CreateAsset(pb, path(pb));
                AssetDatabase.Refresh();
                actions.Add(pb);
                break;
            }
        }
        EditorGUILayout.EndHorizontal();
        List <Action> removeStat = new List <Action>();

        foreach (var i in actions)
        {
            EditorGUILayout.Space(10);
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(i.type);
            if (GUILayout.Button("-"))
            {
                removeStat.Add(i);
            }
            EditorGUILayout.EndHorizontal();
            switch (i.type)
            {
            case "SimpleFly":
                SimpleFly s = (SimpleFly)i;
                Editor.CreateEditor(s).OnInspectorGUI();
                break;

            case "Shoot":
                Shoot sh = (Shoot)i;
                Editor.CreateEditor(sh).OnInspectorGUI();
                break;

            case "RootRandom":
                RootRandom rr = (RootRandom)i;
                Editor.CreateEditor(rr).OnInspectorGUI();
                break;

            case "HorizontMove":
                HorizontMove hM = (HorizontMove)i;
                Editor.CreateEditor(hM).OnInspectorGUI();
                break;

            case "PutBomb":
                PutBomb pb = (PutBomb)i;
                Editor.CreateEditor(pb).OnInspectorGUI();
                break;
            }
            EditorGUILayout.Space(10);
            EditorGUILayout.LabelField("--------------------------------------------------------------");
        }

        foreach (var i in removeStat)
        {
            actions.Remove(i);
        }
        //EditorUtility.SetDirty(ai);
        serializedObject.ApplyModifiedProperties();
    }
Пример #60
0
    private IEnumerator addComponentByName(GameObject go, GameObject staticGO, string name, string data1, string data2, string data3, string data4, string data5)
    {
        go.layer       = LayerMask.NameToLayer("BlockingLayer");
        staticGO.layer = LayerMask.NameToLayer("BlockingLayer");
        switch (name)
        {
        case "PathFollowing":
            go.AddComponent <PathFollowing>().initDrawing(0, true).setStateToIdle();
            staticGO.AddComponent <PathFollowing>().initDrawing(0, false).setStateToIdle();
            break;

        case "SpriteRenderer":
        {
            SpriteRenderer r  = go.AddComponent <SpriteRenderer>();
            SpriteRenderer sr = staticGO.AddComponent <SpriteRenderer>();
            if (data1.Length > 0)
            {
                int index = data1.LastIndexOf('_');
                if (index > 0)
                {
                    int spriteIndex;
                    if (Int32.TryParse(data1.Substring(index + 1), out spriteIndex))
                    {
                        string   path    = data1.Substring(0, index);
                        Sprite[] sprites = Resources.LoadAll <Sprite>(path);
                        if (spriteIndex < sprites.Length)
                        {
                            r.sprite  = sprites[spriteIndex];
                            sr.sprite = sprites[spriteIndex];
                        }
                    }
                }
                else
                {
                    r.sprite  = Resources.Load <Sprite>(data1);
                    sr.sprite = Resources.Load <Sprite>(data1);
                }
            }
            if (data2.Length > 0)
            {
                r.sortingLayerName  = data2;
                sr.sortingLayerName = data2;
            }
        }
        break;

        case "Animator":
            go.AddComponent <Animator>().runtimeAnimatorController       = Resources.Load <RuntimeAnimatorController>(data1);
            staticGO.AddComponent <Animator>().runtimeAnimatorController = Resources.Load <RuntimeAnimatorController>(data1);
            break;

        case "BoxCollider2D":
        {
            BoxCollider2D bc  = go.AddComponent <BoxCollider2D>();
            BoxCollider2D sbc = staticGO.AddComponent <BoxCollider2D>();
            bool          trigger;
            if (Boolean.TryParse(data1, out trigger))
            {
                bc.isTrigger  = trigger;
                sbc.isTrigger = trigger;
            }
        }
        break;

        case "RigidBody2D":
        {
            Rigidbody2D rb = go.AddComponent <Rigidbody2D>();
            bool        kinematic, fixedAngle;
            if (Boolean.TryParse(data1, out kinematic))
            {
                rb.isKinematic = kinematic;
            }
            if (Boolean.TryParse(data2, out fixedAngle))
            {
                rb.fixedAngle = fixedAngle;
            }
        }
        break;

        case "Tag":
            go.tag = data1;
            if (data1 == "PaintableBackground")
            {
                staticGO.tag = data1;
            }
            break;

        case "CustomScript":
            go.AddComponent(Type.GetType(data1));
            break;

        case "Move":
        {
            Move mc = go.AddComponent <Move>();
            mc.maxSpeed[0] = float.Parse(data1);
            mc.maxSpeed[1] = float.Parse(data2);
            mc.maxSpeed[2] = float.Parse(data3);
            mc.maxSpeed[3] = float.Parse(data4);
        }
        break;

        case "Jump":
        {
            go.AddComponent <Jump>();

            Rigidbody2D rb = null;
            rb = go.GetComponent <Rigidbody2D>();

            if (rb == null)
            {
                rb = go.AddComponent <Rigidbody2D>();
            }

            rb.isKinematic = false;
            rb.fixedAngle  = true;
        }
        break;

        case "Health":
        {
            BoxCollider2D c = null;
            c = go.GetComponent <BoxCollider2D>();

            if (c == null)
            {
                c = go.AddComponent <BoxCollider2D>();
            }

            Health h = go.AddComponent <Health>();
            Int32.TryParse(data1, out h.maxHP);
            Int32.TryParse(data2, out h.startHP);
            Int32.TryParse(data3, out h.directions);
            int deathAction;
            if (Int32.TryParse(data4, out deathAction))
            {
                h.setDeathAction(deathAction);
            }
            float.TryParse(data5, out h.damageCooldown);
        }
        break;

        case "Resize":
        {
            Resize r = staticGO.AddComponent <Resize>();
            r.arrowPrefab = pentaArrow;
            r.nonStatic   = go;
        }
        break;

        case "CollideTrigger":
        {
            CollideTrigger ct = go.GetComponent <CollideTrigger>();
            if (ct == null)
            {
                ct = go.AddComponent <CollideTrigger>();
            }
            CustomAction.ActionTypes a = (CustomAction.ActionTypes)Enum.Parse(typeof(CustomAction.ActionTypes), data1);
            int directions;
            Int32.TryParse(data2, out directions);

            string[]      delimiters = { "|" };
            string[]      tags = data3.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);
            List <String> includedTags = new List <String>(), excludedTags = new List <String>();
            for (int i = 0; i < tags.Length; i++)
            {
                if (tags[i].StartsWith("!"))
                {
                    string tag = tags[i].Substring(1);
                    excludedTags.Add(tag);
                }
                else
                {
                    includedTags.Add(tags[i]);
                }
            }

            switch (a)
            {
            case CustomAction.ActionTypes.Spawn:
            {
                Spawn  s       = go.AddComponent <Spawn>();
                string rfidKey = data4;

                if (database.ContainsKey(rfidKey))
                {
                    s.toSpawn = database[rfidKey].first;
                }
                else
                {
                    string url = "http://" + databaseAddress + "/playtime/getComponents.php";
                    yield return(StartCoroutine(pollDatabase(url, rfidKey, false)));

                    if (database.ContainsKey(rfidKey))
                    {
                        s.toSpawn = database[rfidKey].first;
                    }
                }

                int spawnCount = 0;
                Int32.TryParse(data5, out spawnCount);
                s.setMaxSpawnCount(spawnCount);
                s.includedTags = includedTags;
                s.excludedTags = excludedTags;
                ct.actions.Add(s);
                ct.directions.Add(directions);
            }
            break;

            case CustomAction.ActionTypes.Despawn:
            {
                Despawn d = go.AddComponent <Despawn>();
                int     deathAnimID;
                int.TryParse(data4, out deathAnimID);
                d.deathAnimID        = deathAnimID;
                d.defaultDeathAnimID = deathAnimID;
                d.includedTags       = includedTags;
                d.excludedTags       = excludedTags;
                ct.actions.Add(d);
                ct.directions.Add(directions);
            }
            break;

            case CustomAction.ActionTypes.Transfigure:
            {
                Transfigure t = go.GetComponent <Transfigure>();
                if (t == null)
                {
                    t = go.AddComponent <Transfigure>();
                }
                bool repeatable;
                Boolean.TryParse(data5, out repeatable);
                t.addTargetAnimControllerAndTags(data4, includedTags, excludedTags, repeatable, ct.actions.Count);
                ct.actions.Add(t);
                ct.directions.Add(directions);
            }
            break;

            case CustomAction.ActionTypes.DespawnOther:
            {
                DespawnOther dOther = go.AddComponent <DespawnOther>();
                dOther.includedTags = includedTags;
                dOther.excludedTags = excludedTags;
                ct.actions.Add(dOther);
                ct.directions.Add(directions);
            }
            break;

            case CustomAction.ActionTypes.RespawnOther:
            {
                RespawnOther rOther = go.AddComponent <RespawnOther>();
                rOther.includedTags = includedTags;
                rOther.excludedTags = excludedTags;
                ct.actions.Add(rOther);
                ct.directions.Add(directions);
            }
            break;

            case CustomAction.ActionTypes.Damage:
            {
                Damage d = go.AddComponent <Damage>();
                d.includedTags = includedTags;
                d.excludedTags = excludedTags;
                Int32.TryParse(data4, out d.dmg);
                ct.actions.Add(d);
                ct.directions.Add(directions);
            }
            break;

            case CustomAction.ActionTypes.MoveHoriz:
            {
                MoveHorizontalUntilCollision m = go.AddComponent <MoveHorizontalUntilCollision>();
                m.includedTags = includedTags;
                m.excludedTags = excludedTags;
                float.TryParse(data4, out m.speed);
                m.tagsToIgnore = new List <string>(data5.Split(delimiters, StringSplitOptions.RemoveEmptyEntries));
                ct.actions.Add(m);
                ct.directions.Add(directions);
            }
            break;

            case CustomAction.ActionTypes.CustomScript:
            {
                Type         t    = Type.GetType(data4);
                Component    comp = go.AddComponent(t);
                CustomAction c    = (CustomAction)comp;
                c.includedTags = includedTags;
                c.excludedTags = excludedTags;
                ct.actions.Add(c);
                ct.directions.Add(directions);
            }
            break;

            case CustomAction.ActionTypes.Bounce:
            {
                Bounce b = go.AddComponent <Bounce>();
                b.includedTags = includedTags;
                b.excludedTags = excludedTags;
                float bounceHeight;
                float.TryParse(data4, out bounceHeight);
                b.bounceHeight = bounceHeight;
                ct.actions.Add(b);
                ct.directions.Add(directions);
            }
            break;

            default:
                break;
            }
        }
        break;

        case "TimeTrigger":
        {
            TimeTrigger tt = go.GetComponent <TimeTrigger>();
            if (tt == null)
            {
                tt = go.AddComponent <TimeTrigger>();
            }
            CustomAction.ActionTypes a = (CustomAction.ActionTypes)Enum.Parse(typeof(CustomAction.ActionTypes), data1);
            float time;
            float.TryParse(data2, out time);
            bool repeats = false;
            bool.TryParse(data3, out repeats);

            switch (a)
            {
            case CustomAction.ActionTypes.Spawn:
            {
                Spawn  s       = go.AddComponent <Spawn>();
                string rfidKey = data4;

                if (database.ContainsKey(rfidKey))
                {
                    s.toSpawn = database[rfidKey].first;
                }
                else
                {
                    string url = "http://" + databaseAddress + "/playtime/getComponents.php";
                    yield return(StartCoroutine(pollDatabase(url, rfidKey, false)));

                    if (database.ContainsKey(rfidKey))
                    {
                        s.toSpawn = database[rfidKey].first;
                    }
                }

                int spawnCount = 0;
                Int32.TryParse(data5, out spawnCount);
                s.setMaxSpawnCount(spawnCount);
                tt.actions.Add(s);
                tt.originalTimes.Add(time);
                tt.repeats.Add(repeats);
            }
            break;

            case CustomAction.ActionTypes.Despawn:
            {
                Despawn d = go.AddComponent <Despawn>();
                tt.actions.Add(d);
                tt.originalTimes.Add(time);
                tt.repeats.Add(repeats);
            }
            break;

            case CustomAction.ActionTypes.Transfigure:
            {
                Transfigure t = go.GetComponent <Transfigure>();
                if (t == null)
                {
                    t = go.AddComponent <Transfigure>();
                }
                bool repeatable;
                Boolean.TryParse(data5, out repeatable);
                List <string> tags = new List <string>();
                t.addTargetAnimControllerAndTags(data4, tags, tags, repeatable, tt.actions.Count);
                tt.actions.Add(t);
                tt.originalTimes.Add(time);
                tt.repeats.Add(repeats);
            }
            break;

            case CustomAction.ActionTypes.DespawnOther:
            {
                DespawnOther dOther = go.AddComponent <DespawnOther>();
                tt.actions.Add(dOther);
                tt.originalTimes.Add(time);
                tt.repeats.Add(repeats);
            }
            break;

            case CustomAction.ActionTypes.RespawnOther:
            {
                RespawnOther rOther = go.AddComponent <RespawnOther>();
                tt.actions.Add(rOther);
                tt.originalTimes.Add(time);
                tt.repeats.Add(repeats);
            }
            break;

            case CustomAction.ActionTypes.Damage:
            {
                Damage d = go.AddComponent <Damage>();
                Int32.TryParse(data4, out d.dmg);
                tt.actions.Add(d);
                tt.originalTimes.Add(time);
                tt.repeats.Add(repeats);
            }
            break;
            }
        }
        break;

        case "DeathTrigger":
        {
            DeathTrigger dt = go.GetComponent <DeathTrigger>();
            if (dt == null)
            {
                dt = go.AddComponent <DeathTrigger>();
            }
            CustomAction.ActionTypes a = (CustomAction.ActionTypes)Enum.Parse(typeof(CustomAction.ActionTypes), data1);

            switch (a)
            {
            case CustomAction.ActionTypes.Spawn:
            {
                Spawn  s       = go.AddComponent <Spawn>();
                string rfidKey = data2;

                if (database.ContainsKey(rfidKey))
                {
                    s.toSpawn = database[rfidKey].first;
                }
                else
                {
                    string url = "http://" + databaseAddress + "/playtime/getComponents.php";
                    yield return(StartCoroutine(pollDatabase(url, rfidKey, false)));

                    if (database.ContainsKey(rfidKey))
                    {
                        s.toSpawn = database[rfidKey].first;
                    }
                }

                int spawnCount = 0;
                Int32.TryParse(data3, out spawnCount);
                s.setMaxSpawnCount(spawnCount);
                s.spawnUnderParent = true;
                dt.actions.Add(s);
            }
            break;

            default:
                break;
            }
        }
        break;

        case "Invisible":
        {
            Invisible i = go.AddComponent <Invisible>();
            i.reset();
        }
        break;

        case "MoveHorizontalUntilCollision":
        {
            MoveHorizontalUntilCollision m = go.AddComponent <MoveHorizontalUntilCollision>();
            List <String> ignoredTags;
            string[]      delimiters = { "|" };
            string[]      tags       = data1.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);
            ignoredTags    = new List <string>(tags);
            m.tagsToIgnore = ignoredTags;
        }
        break;

        case "Spawn":
        {
            Spawn  s       = go.AddComponent <Spawn>();
            string rfidKey = data1;

            if (database.ContainsKey(rfidKey))
            {
                s.toSpawn = database[rfidKey].first;
            }
            else
            {
                string url = "http://" + databaseAddress + "/playtime/getComponents.php";
                yield return(StartCoroutine(pollDatabase(url, rfidKey, false)));

                if (database.ContainsKey(rfidKey))
                {
                    s.toSpawn = database[rfidKey].first;
                }
            }

            int spawnCount = 0;
            int.TryParse(data2, out spawnCount);
            s.setMaxSpawnCount(spawnCount);
        }
        break;

        case "Despawn":
        {
            Despawn d = go.AddComponent <Despawn>();
            int     deathAnimID;
            int.TryParse(data1, out deathAnimID);
            d.deathAnimID        = deathAnimID;
            d.defaultDeathAnimID = deathAnimID;
        }
        break;

        case "ChildObject":
        {
            string     rfidKey = data1;
            GameObject child, staticChild;

            if (database.ContainsKey(rfidKey))
            {
                child       = database[rfidKey].first;
                staticChild = database[rfidKey].second;
            }
            else
            {
                string url = "http://" + databaseAddress + "/playtime/getComponents.php";
                yield return(StartCoroutine(pollDatabase(url, rfidKey, false)));

                if (database.ContainsKey(rfidKey))
                {
                    child       = database[rfidKey].first;
                    staticChild = database[rfidKey].second;

                    Vector2 offset = new Vector2();
                    float.TryParse(data2, out offset.x);
                    float.TryParse(data3, out offset.y);

                    child.transform.parent        = go.transform;
                    child.transform.localPosition = offset;
                    child.SetActive(true);
                    staticChild.transform.parent        = staticGO.transform;
                    staticChild.transform.localPosition = offset;
                    staticChild.SetActive(true);
                }
            }
        }
        break;

        case "JumpAI":
        {
            go.AddComponent <JumpAI>();
        }
        break;

        case "Chase":
        {
            go.AddComponent <Chase>();
        }
        break;

        case "Shoot":
        {
            Shoot  s       = go.AddComponent <Shoot>();
            string rfidKey = data1;

            if (database.ContainsKey(rfidKey))
            {
                s.projectile = database[rfidKey].first;
            }
            else
            {
                string url = "http://" + databaseAddress + "/playtime/getComponents.php";
                yield return(StartCoroutine(pollDatabase(url, rfidKey, false)));

                if (database.ContainsKey(rfidKey))
                {
                    s.projectile = database[rfidKey].first;
                }
            }
            float.TryParse(data2, out s.projectileSpeed);
        }
        break;

        case "Color":
        {
            ColorComponent c = go.AddComponent <ColorComponent>();
            float.TryParse(data1, out c.r);
            float.TryParse(data2, out c.g);
            float.TryParse(data3, out c.b);
            float.TryParse(data4, out c.a);
        }
        break;

        default:
            print("Component " + name + " is undefined.");
            break;
        }
    }