Inheritance: MonoBehaviour
コード例 #1
0
 // Use this for initialization
 void Start()
 {
     lightning = GetComponent<Lightning>();
     lightning.enabled = false;
     player = GetComponent<IPlayer>();
     lightning.maxLength = 200f;
 }
コード例 #2
0
ファイル: ChunkCache.cs プロジェクト: su636/voxeliq
        private void ProcessChunkInViewRange(Chunk chunk)
        {
            if (chunk.ChunkState == ChunkState.Ready || chunk.ChunkState == ChunkState.AwaitingRemoval)
                return;

            switch (chunk.ChunkState) // switch on the chunk state.
            {
                case ChunkState.AwaitingGenerate:
                    Generator.Generate(chunk);
                    break;
                case ChunkState.AwaitingLighting:
                case ChunkState.AwaitingRelighting:
                    Lightning.Process(chunk);
                    break;
                case ChunkState.AwaitingBuild:
                case ChunkState.AwaitingRebuild:
                    this.VertexBuilder.Build(chunk);
                    break;
                default:
                    break;
            }
        }
コード例 #3
0
ファイル: LightningSpell.cs プロジェクト: Cetzcher/Snippet
        protected override void CastInternal(Character caller)
        {
            var impactDist = caller.transform.forward * m_distance;
            var startPoint = caller.transform.position + caller.transform.forward * 0.5F;

            Lightning lh = Instantiate <Lightning>(m_lightningPrefab);

            lh.transform.position = startPoint;

            RaycastHit rh;

            if (Physics.Raycast(startPoint, transform.forward, out rh, impactDist.magnitude))
            {
                if (rh.collider.gameObject.GetComponentInterface <IHealth>() != null)
                {
                    rh.collider.gameObject.GetComponentInterface <IHealth>().Health -= m_damage;
                }
                impactDist = rh.point;
            }

            lh.Strike(impactDist);
        }
コード例 #4
0
    public void Hold()
    {
        RaycastHit hit;
        Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        if (Physics.Raycast(ray, out hit))
        {
            Vector3 lightningAim = hit.point;
            float   aimDistance  = Vector3.Distance(this.gameObject.transform.position, lightningAim);

            if (aimDistance <= range)
            {
                GameObject lightningGO = Instantiate(lightningPrefab, barrelExit.position, Quaternion.identity);
                lightningGO.transform.SetParent(this.gameObject.transform);
                lightningGO.transform.LookAt(lightningAim);

                Lightning lightning = lightningGO.GetComponent <Lightning>();
                lightning.Setup(null, aimDistance + 0.25f, applyChains, chainRange, chainLightningPrefab, damage);

                desiredSpeed = maxArmSpeed;
            }
        }
    }
コード例 #5
0
    IEnumerator secondScene()
    {
        ++othercounter;
        Debug.Log("A");
        yield return(new WaitForSeconds(.5f));

        topBar.GetComponent <Animator>().enabled = true;
        botBar.GetComponent <Animator>().enabled = true;
        sign.GetComponent <Animator>().enabled   = true;
        house.GetComponent <Animator>().enabled  = true;
        ground.GetComponent <Animator>().enabled = true;
        Ape.GetComponent <Animator>().SetTrigger("zoom");
        thunder.SetActive(true);
        yield return(new WaitForSeconds(.6f));

        // yield return new WaitForSeconds(.2f);
        GetComponent <Text>().text = " ";
        Lightning.SetActive(true);
        yield return(new WaitForSeconds(.12f));

        Eyes.SetActive(true);
        ++othercounter;
    }
コード例 #6
0
    public override void Attack()
    {
        if (null == target)
        {
            return;
        }
        deltaTime = 0.0f;

        int count = Random.Range(3, 5);

        for (int i = 0; i < count; i++)
        {
            Lightning lightning = GameObject.Instantiate <Lightning> (lightningPrefab);
            lightning.start         = transform.position;
            lightning.end           = target.center;
            lightning.sparkCount    = (int)(data.time / interval);
            lightning.sparkWidth    = Random.Range(0.01f, 0.05f);
            lightning.sparkDuration = interval;
            lightning.transform.SetParent(transform);
        }

        StartCoroutine(Lightning());
    }
コード例 #7
0
        private void TextBoxBlue_TextChanged(object sender, RoutedEventArgs e)
        {
            if (TextBoxRed != null && TextBoxGreen != null && TextBoxBlue != null && TextBoxHex != null)
            {
                int x = 0;
                if (int.TryParse(this.TextBoxBlue.Text, out x))
                {
                    if (Regex.IsMatch(this.TextBoxBlue.Text, "0/d"))
                    {
                        this.TextBoxBlue.Text       = this.TextBoxBlue.Text.Substring(1);
                        this.TextBoxBlue.CaretIndex = this.TextBoxBlue.Text.Length;
                    }
                    if (x >= 0 && x <= 255)
                    {
                        Lightning.changeColorBlue((byte)x);
                        tbblue = x;
                        updateColor();

                        string s = Convert.ToString(x, 16).ToUpper();
                        if (!Regex.IsMatch(s, ".{2}"))
                        {
                            s = "0" + s;
                        }
                        s = TextBoxHex.Text.Substring(0, 4) + s;
                        if (TextBoxHex.Text != s)
                        {
                            TextBoxHex.Text = s;
                        }
                    }
                    else
                    {
                        this.TextBoxBlue.Text       = tbblue.ToString();
                        this.TextBoxBlue.CaretIndex = this.TextBoxBlue.Text.Length;
                    }
                }
            }
        }
コード例 #8
0
        public static Mobile BuildMobile(MobileType mobileType, Player player, Vector2 position, bool isInGame = true)
        {
            Mobile mobile = null;

            switch (mobileType)
            {
            case MobileType.Random:       mobile = new Random(player, position);       break;

            case MobileType.Armor:        mobile = new Armor(player, position);        break;

            case MobileType.Bigfoot:      mobile = new Bigfoot(player, position);      break;

            case MobileType.Dragon:       mobile = new Dragon(player, position);       break;

            case MobileType.Mage:         mobile = new Mage(player, position);         break;

            case MobileType.Ice:          mobile = new Ice(player, position);          break;

            case MobileType.Knight:       mobile = new Knight(player, position);       break;

            case MobileType.RaonLauncher: mobile = new RaonLauncher(player, position); break;

            case MobileType.Trico:        mobile = new Trico(player, position);        break;

            case MobileType.Turtle:       mobile = new Turtle(player, position);       break;

            case MobileType.Lightning:    mobile = new Lightning(player, position);    break;
            }

            if (isInGame)
            {
                mobile.HideLobbyExclusiveAvatars();
            }

            return(mobile);
        }
コード例 #9
0
    void Start()
    {
        burst = duration < 0;
        lr    = GetComponent <LineRenderer>();
        if (lr != null)
        {
            Destroy(gameObject, burst ? burstDuration : duration);
            UpdateLinePosition();
        }
        ps = GetComponent <ParticleSystem>();
        if (ps != null)
        {
            if (burst)
            {
                transform.position = (Vector3)target.position + positionAdjust;
                Destroy(gameObject, ps.main.duration);
            }
            else
            {
                UpdateParticleOriginDirection();
                Destroy(gameObject, duration);
            }
            ps.Play();
        }
        lightning = GetComponentInChildren <Lightning>();
        if (lightning != null)
        {
            Destroy(gameObject, burst ? burstDuration : duration);
            UpdateLightningPosition();
        }

        if (lr == null && ps == null && lightning == null)
        {
            Destroy(gameObject);
        }
    }
コード例 #10
0
    // Use this for initialization
    void Start()
    {
        maxHealth = health;
        gui       = GameObject.Find("GameCanvas").GetComponent <GUIManager>();
        timer     = GameObject.Find("GameManager").GetComponent <TimerManager>();
        gm        = GameObject.Find("GameManager").GetComponent <GameManager>();
        sounds    = GameObject.Find("Audio").GetComponent <AudioManager>();

        arcmover = GetComponent <ArcMover2D>();

        transform.position = rightPosition.position;

        player = GameObject.FindGameObjectWithTag("Player");

        fireSegment = (float)2 / bulletAmount;

        sprites       = GetComponentsInChildren <SpriteMeshInstance>();
        originalColor = sprites[0].color;

        lightning = GetComponentInChildren <Lightning>();

        dropper         = GetComponent <DropToGround>();
        dropper.enabled = false;
    }
コード例 #11
0
        private void ButtonAnimationsSmiles_Click(object sender, RoutedEventArgs e)
        {
            if (Lightning.animations)
            {
                if (Lightning.ai != 1)
                {
                    updateSettings();
                    deselectAllButtons();
                    ButtonSelect(this.ButtonAnimationsSmiles, this.ButtonAnimationsSmilesImageBrush, this.ButtonAnimationsSmilesText, this.ButtonAnimationsSmilesBorder);

                    this.SliderSpeed.Maximum = 5;
                    this.SliderSpeed.Minimum = 0.5;
                    this.SliderSpeed.Value   = Properties.Settings.Default.SmilesSpeed;
                    this.SliderBright.Value  = Properties.Settings.Default.SmilesBrightness;
                    this.TextBoxRed.Text     = Properties.Settings.Default.SmilesRed.ToString();
                    this.TextBoxGreen.Text   = Properties.Settings.Default.SmilesGreen.ToString();
                    this.TextBoxBlue.Text    = Properties.Settings.Default.SmilesBlue.ToString();

                    hideAllAlgsSettings();

                    Lightning.runNewAlg(1);
                }
            }
        }
コード例 #12
0
 void Start()
 {
     lightning = GetComponent<Lightning>();
     lightning.maxLength = maxDistance;
     beamSpeedTimer = 0;
     GrapplePhysics.reelSpeed = reelSpeed;
     GrapplePhysics.stabilizer = stabilizer;
     player = (AbstractPlayer)GameManager.instance.CurrentPlayer;
 }
コード例 #13
0
ファイル: Lightning.cs プロジェクト: lancetipton04/VG
	void Awake(){
		instance = this;
		strikeTimer = Time.time + Random.Range(1, 5);
		Flash.SetActive(false);
	}
コード例 #14
0
    IEnumerator LightningBranch(string powerup = "")
    {
        yield return(new WaitForSeconds(0.1f));

        Slot      currentSlot = chip.slot;
        Chip      nextChip;
        Slot      nextSlot;
        Lightning lightning = null;
        int       iter      = 10;
        int       count     = 10;

        List <Chip> branch = new List <Chip>();

        while (true)
        {
            if (iter <= 0 || count <= 0)
            {
                break;
            }

            nextSlot = currentSlot.nearSlot.Values.Where(x => x != null).ToList().GetRandom();
            if (!nextSlot)
            {
                iter--;
                continue;
            }
            nextChip = nextSlot.chip;
            if (!nextChip || nextChip.destroying)
            {
                iter--;
                continue;
            }
            if (!currentSlot.chip)
            {
                iter--;
                continue;
            }

            if (chips.Contains(nextChip) || branch.Contains(nextChip))
            {
                iter--;
                continue;
            }

            chips.Add(nextChip);
            branch.Add(nextChip);

            int id = nextChip.id;

            if (lightning != null)
            {
                lightning.Remove();
            }
            lightning = Lightning.CreateLightning(0, currentSlot.chip.transform, nextChip.transform, id == Mathf.Clamp(id, 0, 5) ? Chip.colors[id] : Color.white);

            count--;

            currentSlot.chip.SetScore(0.3f);
            currentSlot.chip.jamType = chip.jamType;
            currentSlot.chip.DestroyChip();
            currentSlot = nextSlot;

            yield return(new WaitForSeconds(0.02f));
        }


        if (powerup != "")
        {
            bool dontDestroy = powerup == "RainbowHeart" || powerup == "UltraColorBomb";
            Chip pu          = FieldAssistant.main.AddPowerup(currentSlot.coord, powerup);
            //if (!dontDestroy)
            //    pu.can_move = false;
            pu.transform.localPosition = Vector3.zero;

            yield return(0);

            while (!dontDestroy && pu != null && pu.GetComponent <Animation>().isPlaying)
            {
                yield return(0);
            }
            if (pu != null && !dontDestroy)
            {
                SessionAssistant.main.EventCounter();
                pu.jamType = chip.jamType;
                pu.DestroyChip();
            }
        }

        if (lightning != null)
        {
            lightning.Remove();
            if (currentSlot.chip)
            {
                currentSlot.chip.jamType = chip.jamType;
                currentSlot.chip.DestroyChip();
            }
        }

        branchCount--;

        while (branchCount > 0)
        {
            yield return(0);
        }

        yield return(0);

        branchCount = -1;


        //yield return new WaitForSeconds(0.02f);

        //for (int i = 0; i < branch.Count; i++) {
        //    yield return new WaitForSeconds(0.03f);
        //    if (branch[i].destroing || !branch[i].parentSlot)
        //        continue;

        //    branch[i].SetScore(0.1f);
        //    FieldAssistant.main.BlockCrush(branch[i].parentSlot.slot.x, branch[i].parentSlot.slot.y, true);
        //    FieldAssistant.main.JellyCrush(branch[i].parentSlot.slot.x, branch[i].parentSlot.slot.y);
        //    if (branch[i] != chip)
        //        branch[i].DestroyChip();
        //}

        //branchCount--;

        //while (branchCount > 0)
        //    yield return 0;

        //branchCount = -1;
    }
コード例 #15
0
    // Update is called once per frame
    void Update()
    {
        //Select spell
        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            fire      = true;
            lightning = false;
            clone     = false;
        }
        else if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            fire      = false;
            lightning = true;
            clone     = false;
        }
        else if (Input.GetKeyDown(KeyCode.Alpha3))
        {
            fire      = false;
            lightning = false;
            clone     = true;
        }

        //Use spell
        if (!InputManager.isPaused && Input.GetMouseButtonDown(0))
        {
            if (fire == true && fireCoolDown <= 0)
            {
                FireBall  ball = new FireBall();
                Rigidbody clone;
                clone          = Instantiate(fireBall, new Vector3(d.transform.position.x, d.transform.position.y, -1), Quaternion.identity);
                clone.velocity = transform.TransformDirection(Vector3.right * 10);
                fireCoolDown   = 1;
            }
            if (lightning == true && lightningCoolDown <= 0)
            {
                Lightning bolt = new Lightning();
                if (lightningCreate == false)
                {
                    lightningBolt   = Instantiate(lightningBolt, new Vector3(d.transform.position.x, d.transform.position.y, 0), Quaternion.identity);
                    lightningCreate = true;
                }
                buttonHold        = true;
                lightningCoolDown = 10;
            }
            if (clone == true && cloneCoolDown <= 0)
            {
                cloneCreate = false;
                if (cloneCreate == false)
                {
                    Transform cloneCopy;
                    cloneCopy   = Instantiate(cloneBody, new Vector3(d.transform.position.x, d.transform.position.y, -1), Quaternion.identity);
                    cloneCreate = true;
                    Destroy(cloneCopy.gameObject, 5);
                }
                cloneCoolDown = 10;
            }
        }

        //Cooldowns
        fireCoolDown      -= Time.deltaTime;
        lightningCoolDown -= Time.deltaTime;
        cloneCoolDown     -= Time.deltaTime;

        if (Input.GetMouseButtonUp(0))
        {
            buttonHold = false;
        }

        if (buttonHold == true)
        {
            lightningBolt.transform.position = d.transform.position;
        }
        else
        {
            lightningBolt.transform.position = new Vector3(0, 10, 0);
        }
    }
コード例 #16
0
        private Lightning GetLightning()
        {
            Lightning lnd = new Lightning(_myData.CertLocation, _myData.MacLocation, _myData.lndGRPC);

            return(lnd);
        }
コード例 #17
0
ファイル: Ryan.cs プロジェクト: advdotnet/Session-Seven
        public Ryan(Inventory inventory)
        {
            Inventory = inventory;

            CameraLocked
            .Create(this);

            Transform
            .Create(this)
            .SetPosition(350, 250)
            .SetSpeed(120)
            .SetOrientation(-Vector2.UnitY)
            .SetUpdateZWithPosition(true)
            .SetScale(1.0f);

            Sprite
            .Create(this)
            .SetEnableNormalMap(false)
            .SetImage(content.characters.ryan.sprite_blood, 13, 8, 0);

            SpriteTransformAnimation
            .Create(this)
            .SetSetFrameFn(SetFrame);

            SpriteCustomAnimation
            .Create(this)
            .SetGetFramesAction(GetCustomAnimationFrames);

            SpriteData
            .Create(this)
            .SetOrientationFlip(false)
            .SetOffset(-76, -143);

            Text
            .Create(this)
            .SetFont(content.fonts.pixeloperator_outline_BMF)
            .SetWidth(300)
            .SetConstrain(true)
            .SetConstrainingRectangle(new Rectangle(0, 0, Game.VIRTUAL_WIDTH, Game.VIRTUAL_HEIGHT))
            .SetAlign(Alignment.Bottom);

            Navigation
            .Create(this)
            .SetApplyScale(true)
            .SetApplyColoring(true)
            .SetRestrictPosition(true)
            .SetScale(1.75f);

            Scripts
            .Create(this);

            Lightning
            .Create(this)
            .SetLightPosition(new Vector3(new Vector2(51, 61), 0))
            .SetLightColor(new Vector3(1.25f, 0.6f, 0.6f));

            BloodDropEmitter
            .Create(this);

            Score
            .Create(this);

            RandomCountdown
            .Create(this)
            .SetDuration(7)
            .SetMinUpdates(300)
            .SetMaxUpdates(500);
        }
コード例 #18
0
ファイル: Gun.cs プロジェクト: Libeedo/psycho-bob
    //private Transform dummyCam;
    //private Vector3 oldMousePos = Vector3.zero;
    void Awake()
    {
        var wTransform = transform.Find ("weapon Transform");
        anim = GetComponent<Animator>();

        aud = wTransform.Find("Audio").GetComponent<AudioSource>();
        //aud.clip = hgSFX;
        ammoDisp = GameObject.Find("ammoClipTXT").GetComponent<Text>();
        // Setting up the references.

        playerT = GameObject.FindGameObjectWithTag("Player").transform;
        playerCtrl = playerT.GetComponent<PlayerControl>();
        playerHealth = playerT.GetComponent<PlayerHealth>();

        //print (playerT.name);

        playerCtrl.gunCS = this;
        playerAnim = playerT.GetComponent<Animator>();
        kickHit = playerT.Find ("kickHit").GetComponent<KickHit>();

        grabEnemyHitGO = playerT.Find ("grabEnemyHit").gameObject;
        //gehCS = grabEnemyHitGO.GetComponent<GrabEnemyHit> ();
        grabEnemyHitGO.GetComponent<GrabEnemyHit> ().gunCS = this;

        //yellSFX = playerCtrl.jumpFX;//make kick yell SFX same as jump from player control

        head = playerT.Find("head Transform");
        headSR = head.transform.Find ("head").GetComponent<SpriteRenderer>();

        psychoEye = head.Find("head").Find("psychoEye").gameObject;

        SliderJoint2D jnt = playerT.gameObject.AddComponent<SliderJoint2D>();
        jnt.connectedBody = GetComponent<Rigidbody2D>();
        jnt.anchor = new Vector2(0,0.6f);
        jnt.useLimits = true;
        jnt.angle = 90f;
        JointTranslationLimits2D l = new JointTranslationLimits2D();
        l.max = 1.2f;
        jnt.limits = l;

        //WEAPONS STUFF

        handGunWeapon = new Weapon(GunMode.HANDGUN,transform.Find("weapon Transform"));
        handGunWeapon.bulletShell = bulletShells [0];
        machineGunWeapon = new Weapon(GunMode.MACHINEGUN,transform.Find("weapon Transform"));
        machineGunWeapon.bulletShell = bulletShells [0];
        grenadeWeapon = new Weapon (GunMode.GRENADE,transform.Find("weapon Transform"));
        flameWeapon = new Weapon (GunMode.FLAME,transform.Find("weapon Transform"));
        rpgWeapon = new Weapon (GunMode.ROCKET,transform.Find("weapon Transform"));
        punchWeapon = new Weapon (GunMode.PUNCH,transform.Find("weapon Transform"));
        shotGunWeapon = new Weapon (GunMode.SHOTGUN,transform.Find("weapon Transform"));
        shotGunWeapon.bulletShell = bulletShells [1];
        stratWeapon = new Weapon (GunMode.STRAT,transform.Find("weapon Transform"));

        activeWeapon = handGunWeapon;

        weapons[0]=new Weapon(GunMode.UNARMED,transform.Find("weapon Transform"));
        weapons[1]=handGunWeapon;
        weapons[2]=machineGunWeapon;
        weapons[3]=grenadeWeapon;
        weapons[4]=flameWeapon;
        weapons[5]=rpgWeapon;
        weapons[6]=punchWeapon;
        weapons [7] = shotGunWeapon;
        weapons[8] = stratWeapon;

        weaponsForAmmo[0] = machineGunWeapon;
        weaponsForAmmo[1] = grenadeWeapon;
        weaponsForAmmo[2] = flameWeapon;
        weaponsForAmmo[3] = rpgWeapon;
        weaponsForAmmo[4] = punchWeapon;
        weaponsForAmmo [5] = shotGunWeapon;

        gunModes[0]=GunMode.UNARMED;
        gunModes[1]=GunMode.HANDGUN;
        gunModes[2]=GunMode.MACHINEGUN;
        gunModes[3]=GunMode.GRENADE;
        gunModes[4]=GunMode.FLAME;
        gunModes[5]=GunMode.ROCKET;
        gunModes[6]=GunMode.PUNCH;
        gunModes[7]=GunMode.SHOTGUN;
        gunModes[8]=GunMode.STRAT;

        //unarmLGO = playerT.Find ("body").Find("psycho bob_armL").gameObject;//unarmed arms, animated separately
        //unarmRGO = playerT.Find ("body").Find("psycho bob_armR").gameObject;

        handGunGO = wTransform.Find ("handGun3D").gameObject;
        bazookaGO = wTransform.Find ("bazooka3D").gameObject;
        machineGunGO = wTransform.Find ("machineGun3D").gameObject;
        flameThrowerGO = wTransform.Find ("flameThrower3D").gameObject;
        shotGunGO = wTransform.Find ("shotGun3D").gameObject;
        stratGO  = wTransform.Find ("stratGun3D").gameObject;
        rpgGO    = wTransform.Find("bazooka3D").Find("rocket3D").gameObject;
        punchGO  = wTransform.Find("bazooka3D").Find("punch3D").gameObject;

        weaponWheel = transform.Find("UIweaponWheel").gameObject;//GameObject.Find ("UI").transform.Find("UIweaponWheel").gameObject;//playerT.Find("weaponSelect").gameObject;
        weaponWheel.transform.SetParent (GameObject.Find ("UI").transform, false);

        bulletShell_ShotPos =wTransform. transform.Find ("bulletShell_spot");

        handGunFlare = wTransform.Find ("handGun3D").Find ("handGunFlare").GetComponent<ParticleSystem>();
        handGunFlareLight = wTransform.Find ("handGun3D").Find("handGunFlare light").GetComponent<Light>();
        //handGunFlareLight2 = wTransform.Find ("handGun3D").Find("handGunFlare light2").GetComponent<Light>();

        gunFlare = wTransform.Find ("machineGun3D").Find ("gunFlare").GetComponent<ParticleSystem>();
        gunFlareLight = wTransform.Find ("machineGun3D").Find("gunFlare light").GetComponent<Light>();
        //gunFlareLight2 = wTransform.Find ("machineGun3D").Find("gunFlare light2").GetComponent<Light>();

        shotGunFlare = wTransform.Find ("shotGun3D").Find ("gunFlare").GetComponent<ParticleSystem>();
        shotGunFlareLight = wTransform.Find ("shotGun3D").Find("gunFlare light").GetComponent<Light>();
        //shotGunFlareLight2 = wTransform.Find ("shotGun3D").Find("gunFlare light2").GetComponent<Light>();

        flame = wTransform.Find ("flameThrower3D").Find("flame").GetComponent<ParticleSystem>();
        smoke = wTransform.Find ("flameThrower3D").Find("flameSmoke").GetComponent<ParticleSystem>();
        flameLight =  wTransform.Find ("flameThrower3D").Find("flameFX").GetComponent<Light>();
        flameAud = flameLight.gameObject.GetComponent<AudioSource>();

        rpgSmoke = wTransform.Find ("bazooka3D").Find("rpgSmoke").GetComponent<ParticleSystem>();

        stratLightning = transform.Find ("lightning").gameObject;
        stratLightning.transform.parent = null;
        lightningCS = stratLightning.GetComponent<Lightning> ();
        stratLightning.SetActive(false);

        armIK[0] = playerT.Find ("body").Find ("psycho bob_armL").GetComponent<SimpleCCD>();
        armIK[1] = playerT.Find ("body").Find("psycho bob_armR").GetComponent<SimpleCCD>();

        armTargets[0]= transform.Find("weapon Transform").Find ("fArmB_L_IK");//for flipping when gun flips
        armTargets[1]= transform.Find("weapon Transform").Find ("fArmB_R_IK");
        armTargets[2]= playerT.Find ("handL_IK");//for unarmed IK targets
        armTargets[3]= playerT.Find ("handR_IK");
        armTargets[4]= stratGO.transform.Find("handLmg");//for strat
        armTargets[5]= stratGO.transform.Find ("handRmg");
        armTargets[6]= playerT.Find ("handL_IK_grab"); //for grabbing enemies;
        armTargets[7]= playerT.Find ("handR_IK_grab");

        fArmR_SR = armIK[1].transform.Find("psycho bob_fArmR").GetComponent<SpriteRenderer>();
        fArmL_SR = armIK[0].transform.Find("psycho bob_fArmL").GetComponent<SpriteRenderer>();
        armL_SR = armIK[0].transform.parent.Find("psycho bob_armL").GetComponent<SpriteRenderer>();

        //elbowTargets [0] = playerT.Find ("body").Find ("Skeleton").Find ("armB_L_IK");
        //elbowTargets [1] = playerT.Find ("body").Find ("Skeleton").Find ("armB_R_IK");

        armTargetPos[0] = armTargets[0].localPosition;//handgun machine gun L
        armTargetPos[1] = armTargets[1].localPosition;//R
        armTargetPos[2] = new Vector3(-0.8f,-0.4f,armTargets[0].localPosition.z);//flamethrower
        armTargetPos[3] = new Vector3(1.2f,-0.2f,armTargets[1].localPosition.z);
        armTargetPos[4] = new Vector3(-0.6f,-0.1f,armTargets[1].localPosition.z);//bazooka
        armTargetPos[5] = new Vector3(2f,1.57f,armTargets[0].localPosition.z);
        armTargetPos[6] = new Vector3(-.75f,-0.3f,armTargets[0].localPosition.z);//shotgun
        armTargetPos[7] = new Vector3(1.5f,0.5f,armTargets[0].localPosition.z);
        //armTargetPos[8] = new Vector3(-1f,0.8f,armTargets[0].localPosition.z);//strat
        //armTargetPos[9] = new Vector3(1.8f,-0.5f,armTargets[0].localPosition.z);

        hudGun =GameObject.FindGameObjectWithTag("HUD").transform.Find ("gunHUD").Find ("weaponIMG").GetComponent<UI_WeaponDisplay>();

        rightHands[0] = wTransform.Find("handGun3D").Find ("hands2").GetComponent<SpriteRenderer>();
        rightHands[1] = wTransform.Find("machineGun3D").Find ("handRmg").GetComponent<SpriteRenderer>();
        rightHands[2] = wTransform.Find("shotGun3D").Find ("shotgun_grip").Find ("handR").GetComponent<SpriteRenderer>();
        rightHands[3] = wTransform.Find("stratGun3D").Find ("handRmg").GetComponent<SpriteRenderer>();
        rightHands[4] = wTransform.Find("flameThrower3D").Find ("handR").GetComponent<SpriteRenderer>();
        rightHands[5] = wTransform.Find("bazooka3D").Find ("handRbz").GetComponent<SpriteRenderer>();
        //rightHands[6] = wTransform.Find("").Find ("handR").gameObject;
        //rightHands[7] = wTransform.Find("").Find ("handR").gameObject;
        //rightHands[8] = wTransform.Find("").Find ("handR").gameObject;
        //hero = transform.root.gameObject.transform;
        bazookaGO.SetActive(false);
        machineGunGO.SetActive(false);
        //flameThrowerGO.SetActive(false);
        //camera = Camera.main;
        var xhairGO = (GameObject)Instantiate (xhairRef,transform.position  , Quaternion.identity);
        xhair = xhairGO.transform;
        xhair.name = "xhair";
        Cursor.visible = false;

        xhairHUD =GameObject.FindGameObjectWithTag("HUD").transform.Find ("xhairHUD");

        gunMode = GunMode.UNARMED;

        SwitchWeapons();

        cameraXmaxMin = Camera.main.transform.GetComponent<CameraFollow>().GetCameraMaxMin();

        //dummyCam = Camera.main.transform.Find ("dummyCam");
    }
コード例 #19
0
ファイル: ColorMixEffect.cs プロジェクト: dqtoy/Three
    IEnumerator MixEffect()
    {
        yield return(0);

        Chip chip = GetChip();

        while (chip.parentSlot == null)
        {
            yield return(0);
        }
        transform.position = chip.parentSlot.transform.position;

        while (!SessionAssistant.main.CanIWait())
        {
            yield return(0);
        }

        SessionAssistant.main.matching++;

        AudioAssistant.Shot("ColorBombCrush");

        int sx = chip.parentSlot.slot.x;
        int sy = chip.parentSlot.slot.y;

        SimpleChip[]        allChips = GameObject.FindObjectsOfType <SimpleChip> ();
        List <SimpleChip>[] sorted   = new List <SimpleChip> [6];
        int[] count = new int[6];

        foreach (SimpleChip c in allChips)
        {
            if (c.chip.destroing)
            {
                continue;
            }
            count[c.chip.id]++;
            if (sorted[c.chip.id] == null)
            {
                sorted[c.chip.id] = new List <SimpleChip>();
            }
            sorted[c.chip.id].Add(c);
        }

        List <Chip> target = new List <Chip>();

        int i;

        for (i = 0; i < 6; i++)
        {
            if (sorted[i] != null && sorted[i].Count > 0)
            {
                target.Add(sorted[i][Random.Range(0, sorted[i].Count)].chip);
            }
        }
        int x;
        int y;

        for (i = 0; i < target.Count; i++)
        {
            x         = target[i].parentSlot.slot.x;
            y         = target[i].parentSlot.slot.y;
            target[i] = FieldAssistant.main.AddPowerup(x, y, targetBomb);
            Lightning.CreateLightning(3, transform, target[i].transform, Chip.colors[i]);
            yield return(new WaitForSeconds(0.1f));
        }
        yield return(new WaitForSeconds(0.3f));

        SessionAssistant.main.eventCount++;

        for (i = 0; i < target.Count; i++)
        {
            if (target[i])
            {
                target[i].DestroyChip();
            }
            yield return(new WaitForSeconds(0.2f));
        }
        yield return(new WaitForSeconds(0.4f));

        SessionAssistant.main.matching--;

        FieldAssistant.main.BlockCrush(sx, sy, false);
        FieldAssistant.main.JellyCrush(sx, sy);

        destroingLock = false;
        DestroyChipFunction();
    }
コード例 #20
0
ファイル: ColorBomb.cs プロジェクト: mengtest/BerryMatchThree
    // Coroutine destruction / activation
    public IEnumerator Destroying()
    {
        if (birth == SessionAssistant.main.eventCount)
        {
            chip.destroying = false;
            yield break;
        }

        chip.busy = true;

        chip.Play("Destroying");
        AudioAssistant.Shot("ColorBombCrush");

        Slot s;

        if (chip.slot)
        {
            FieldAssistant.main.JellyCrush(chip.slot.coord);
        }

        chip.gravity = false;

        int2 key = new int2();

        for (key.x = 0; key.x < LevelProfile.main.width; key.x++)
        {
            for (key.y = 0; key.y < LevelProfile.main.height; key.y++)
            {
                if (key == chip.slot.coord)
                {
                    continue;
                }
                s = Slot.GetSlot(key);
                if (s && s.chip && s.chip.id == chip.id)
                {
                    Lightning.CreateLightning(3, transform, s.chip.transform, color);
                    yield return(new WaitForSeconds(0.03f));
                }
            }
        }

        yield return(new WaitForSeconds(0.1f));

        for (key.x = 0; key.x < LevelProfile.main.width; key.x++)
        {
            for (key.y = 0; key.y < LevelProfile.main.height; key.y++)
            {
                if (key == chip.slot.coord)
                {
                    continue;
                }
                s = Slot.GetSlot(key);
                if (s && s.chip && s.chip.id == chip.id)
                {
                    s.chip.SetScore(0.3f);
                    FieldAssistant.main.BlockCrush(key, true);
                    FieldAssistant.main.JellyCrush(key);
                    s.chip.jamType = chip.jamType;
                    s.chip.DestroyChip();
                    yield return(new WaitForSeconds(0.02f));
                }
            }
        }

        yield return(new WaitForSeconds(0.1f));

        chip.busy    = false;
        chip.gravity = true;

        while (chip.IsPlaying("Destroying"))
        {
            yield return(0);
        }
        chip.ParentRemove();
        Destroy(gameObject);
    }
コード例 #21
0
 private void Pulse()
 {
     pulseRoutine = new Coroutine(Lightning.PulseRoutine(SceneAs <Level>()));
     Add(pulseRoutine);
 }
コード例 #22
0
ファイル: EnvironmentMaster.cs プロジェクト: Hengle/VoxelGame
    private void LateUpdate()
    {
        if (gmap == null)
        {
            return;
        }
        float t         = Time.deltaTime * GameMaster.gameSpeed,
              ascension = gmap.ascension;

        ;

        //wind:
        {
            windTimer -= t;
            if (windTimer <= 0)
            {
                windTimer     = WIND_CHANGE_TIME * (0.1f + Random.value * 1.9f);
                newWindVector = Quaternion.AngleAxis((0.5f - Random.value) * 30, Vector3.up) * windVector;
                newWindVector = newWindVector * (1 + (0.5f - Random.value) * 0.5f);
            }
            if (windVector != newWindVector)
            {
                float st = WIND_CHANGE_STEP * t;
                windVector = Vector3.RotateTowards(windVector, newWindVector, st, st);
                float windpower = windVector.magnitude;
                Shader.SetGlobalFloat(vegetationShaderWindPropertyID, windpower);
                if (WindUpdateEvent != null)
                {
                    WindUpdateEvent(windVector);
                }
            }
        }

        if (GameMaster.realMaster.gameMode != GameMode.Editor & !GameMaster.loading)
        {
            //if (currentEnvironment.presetType != Environment.EnvironmentPresets.Default)
            //{
            if (environmentEventTimer > 0)
            {
                environmentEventTimer -= t;
                if (environmentEventTimer <= 0)
                {
                    //currentEnvironment.InnerEvent();
                    // environmentEventTimer = currentEnvironment.GetInnerEventTime();
                }
            }
            //}

            var dir = gmap.cityFlyDirection / 500f;
            dir.y = 0;
            if (decorations.Count > 0)
            {
                int     i = 0;
                Vector3 pos;
                float   sqrRadius = SKY_SPHERE_RADIUS * SKY_SPHERE_RADIUS;
                while (i < decorations.Count)
                {
                    pos  = decorations[i].position;
                    pos += dir;
                    decorations[i].position = pos;
                    if (Vector3.SqrMagnitude(pos) > sqrRadius * 4f)
                    {
                        Destroy(decorations[i].gameObject);
                        decorations.RemoveAt(i);
                    }
                    else
                    {
                        i++;
                    }
                }
            }
            if (lastSpawnDistance > 0)
            {
                lastSpawnDistance -= dir.magnitude;
            }

            if (showCelestialBodies)
            {
                if (celestialBodies != null && celestialBodies.Count > 0)
                {
                    Vector3 cpoint = Quaternion.AngleAxis(gmap.cityPoint.angle, Vector3.back) * (Vector3.up * gmap.cityPoint.height);
                    Vector3 mpoint;
                    foreach (var sb in celestialBodies)
                    {
                        mpoint            = Quaternion.AngleAxis(sb.Key.angle, Vector3.back) * (Vector3.up * sb.Key.height);
                        mpoint           -= cpoint;
                        mpoint.z          = mpoint.y * 10f; mpoint.x *= 10f;
                        mpoint.y          = 1f;
                        sb.Value.position = mpoint;
                    }
                }
            }

            //test lightnings
            if (false)
            {
                effectsTimer -= t;
                if (effectsTimer < 0)
                {
                    float f      = Chunk.chunkSize;
                    var   center = GameMaster.sceneCenter;
                    var   pos    = Random.onUnitSphere * f + center;
                    dir  = center - pos;
                    dir += Random.onUnitSphere;
                    RaycastHit rh;
                    if (Physics.Raycast(pos, dir, out rh, 2 * f))
                    {
                        Lightning.Strike(pos, rh.point);
                        var   hitobject = rh.collider;
                        float damage    = Lightning.CalculateDamage();
                        if (hitobject.tag == Structure.STRUCTURE_COLLIDER_TAG)
                        {
                            hitobject.transform.parent.GetComponent <Structure>().ApplyDamage(damage);
                        }
                        else
                        {
                            if (hitobject.tag == Chunk.BLOCK_COLLIDER_TAG)
                            {
                                var crh = GameMaster.realMaster.mainChunk.GetBlock(rh.point, rh.normal);
                                crh.block?.EnvironmentalStrike(crh.faceIndex, rh.point, 2, damage);
                            }
                        }
                    }
                    else
                    {
                        var end = pos + Random.onUnitSphere * 5f;
                        end.y = GameConstants.GetBottomBorder();
                        Lightning.Strike(pos, end);
                    }
                    effectsTimer = 1f;
                }
            }

            //sunlight changing
            var clv         = gmap.cityLookVector;
            var rightVector = Vector3.Cross(clv, Vector3.down);
            sunTransform.forward = Quaternion.AngleAxis(15f + ascension * 75f, rightVector) * clv;

            #region stability
            if (colonyController != null)
            {
                float hc = 1f, gc = 0f;
                hc = colonyController.happiness_coefficient;
                if (colonyController.storage != null)
                {
                    gc = colonyController.storage.standartResources[ResourceType.GRAPHONIUM_ID] / GameConstants.GRAPHONIUM_CRITICAL_MASS;

                    // + блоки?
                }
                float pc  = 0f;
                int   pop = colonyController.citizenCount;
                if (pop > POPULATION_CONDITION_1)
                {
                    if (pop >= POPULATION_CONDITION_3)
                    {
                        pc = POPULATION_STABILITY_EFFECT_3;
                    }
                    else
                    {
                        if (pop > POPULATION_CONDITION_2)
                        {
                            pc = POPULATION_STABILITY_EFFECT_2;
                        }
                        else
                        {
                            pc = POPULATION_STABILITY_EFFECT_1;
                        }
                    }
                }

                float structureStabilizersEffect = 1f;
                if (stabilityModifiers != null && stabilityModifiers.Count > 0)
                {
                    structureStabilizersEffect = 1f;
                    foreach (var sm in stabilityModifiers)
                    {
                        structureStabilizersEffect *= (1f + sm.Value);
                    }
                }
                targetStability =
                    (
                        0.5f * hc // happiness
                        - gc      // graphonium reserves
                        + pc      // population
                        + (1f - ascension) * structureStabilizersEffect
                    )
                    *
                    envStability;
                if (targetStability > 1f)
                {
                    targetStability = 1f;
                }
                else
                {
                    if (targetStability < 0f)
                    {
                        targetStability = 0f;
                    }
                }
                if (islandStability != targetStability)
                {
                    islandStability = Mathf.MoveTowards(islandStability, targetStability, GameConstants.STABILITY_CHANGE_SPEED * Time.deltaTime);
                }
                if (islandStability < 1f)
                {
                    float lcf  = colonyController.GetLevelCf();
                    float step = lcf > 1f ? 0f : CITY_CHANGE_HEIGHT_STEP * (1f - islandStability) * t * (1f - lcf);
                    if (step != 0f)
                    {
                        if (ascension < 0.5f)
                        {
                            if (gmap.cityPoint.height != 1f)
                            {
                                gmap.ChangeCityPointHeight(step);
                                positionChanged = true;
                            }
                        }
                        else
                        {
                            if (gmap.cityPoint.height != 0f)
                            {
                                gmap.ChangeCityPointHeight(-step);
                                positionChanged = true;
                            }
                        }
                    }
                }
            }
            // обновление освещения при движении города
            if (positionChanged)
            {
                RefreshEnvironment();
            }
            #endregion
        }
    }
コード例 #23
0
    void instantiateLightining(Lightning lightning)
    {
        Lightning instance = (Lightning)GameObject.Instantiate((Object)lightning, transform);

        lightningInsts.Add(instance);
    }
コード例 #24
0
 void Start()
 {
     lightMan = GameObject.FindObjectOfType <Lightning>();
 }
コード例 #25
0
 private void Pulse()
 {
     SceneAs <Level>().Shake(.2f);
     Add(new Coroutine(Lightning.PulseRoutine(SceneAs <Level>())));
 }
コード例 #26
0
ファイル: Lightning.cs プロジェクト: rossborchers/BadBadBoats
 // Start is called before the first frame update
 void Start()
 {
     light    = GetComponent <Light>();
     Instance = this;
 }
コード例 #27
0
        public void Update(QuadTree quadTree)
        {
            if (mLightningactivated)
            {
                // damage a ship if its too close to a storm.
                FisherShip dummyShip          = new FisherShip(new Vector2(mStormRegion.X + (mStormRegion.Width / 2), mStormRegion.Y + (mStormRegion.Height / 2)));
                var        possibleCollisions = new List <AShip>();
                quadTree.Retrieve(possibleCollisions, dummyShip);
                if (possibleCollisions.Count > 0)
                {
                    foreach (var pCShip in possibleCollisions)
                    {
                        if (mStormRegion.Contains(pCShip.Position) && mCounter >= 500 &&
                            pCShip.Owned)
                        {
                            var lightning = new Lightning(mAnim, pCShip.Position - new Vector2(0, 75));
                            MapScreen.mSmallThingsManager.AddThing(lightning);
                            if (pCShip.Owned)
                            {
                                SoundManager.PlayEfx("efx/ambience/Storm/rain_thunder");
                            }
                            pCShip.Hp -= 1;
                            mCounter   = 0;
                        }
                        if (mStormRegion.Contains(pCShip.Position) && mCounter < 500)
                        {
                            mCounter += 1;
                        }
                    }
                }


                if (mLightningCounter >= mNewLightning)
                {
                    var lightning = new Lightning(mAnim,
                                                  new Vector2(mGenerator.Next(mStormRegion.X + 75, mStormRegion.X + mStormRegion.Width - 75),
                                                              mGenerator.Next(mStormRegion.Y + 75, mStormRegion.Y + mStormRegion.Height - 75)));
                    MapScreen.mSmallThingsManager.AddThing(lightning);
                    mLightningCounter = 0;
                    mNewLightning     = mGenerator.Next(10, 100);
                    mTimeToLive      -= 1;
                    if (mTimeToLive < 0)
                    {
                        SoundManager.Stop("efx/ambience/Storm/rain_thunder");
                        mDestroyed = true;
                        EnvironmentManager.mStormNumber -= 1;
                        Despawn();
                        if (mCheckCloud.mDespawnComplete)
                        {
                            foreach (var cloud in mStormClouds)
                            {
                                cloud.KillCloud();
                            }
                        }
                    }
                }
                else
                {
                    mLightningCounter += 1;
                }
            }
            else
            {
                if (mCheckCloud.mFadingCompleted)
                {
                    mLightningactivated = true;
                }
            }
        }
コード例 #28
0
 void Awake()
 {
     m_Lightning = gameObject.GetComponentInChildren <Lightning>();
 }
コード例 #29
0
ファイル: Helper.cs プロジェクト: Canados1985/Bubbles-Numbers
    ////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////


    void SpawnLootInGameWorld()
    {
        if (!gameManagerRef.deleteGame)
        {
            int randomChanse = Random.Range(0, 11); // Random chanse for call event

            //Debug.Log(randomChanse);
            if (randomChanse >= 3 && !gameManagerRef.playerRef.playerLostBubble)
            {
                int randomItem = Random.Range(0, 12);
                //Debug.Log(randomItem);

                //POISON
                if (randomItem == 7)
                {
                    Poison tempLoot = Instantiate(poison_Loot).GetComponent <Poison>();
                    tempLoot.name = "Poison_Loot";
                    tempLoot.gameObject.SetActive(true);
                }
                //FROZEN
                if (randomItem == 6)
                {
                    Frozen tempLoot = Instantiate(frozen_Loot).GetComponent <Frozen>();
                    tempLoot.name = "Frozen_Loot";
                    tempLoot.gameObject.SetActive(true);
                }
                //BOMB
                if (randomItem == 5)
                {
                    Bomb tempLoot = Instantiate(bomb_Loot).GetComponent <Bomb>();
                    tempLoot.name = "Bomb_Loot";
                    tempLoot.gameObject.SetActive(true);
                }
                //LIGHTNING
                if (randomItem == 4)
                {
                    Lightning tempLoot = Instantiate(lightning_Loot).GetComponent <Lightning>();
                    tempLoot.name = "Lightning_Loot";
                    tempLoot.gameObject.SetActive(true);
                }
                //COPY
                if (randomItem == 3)
                {
                    Copy tempLoot = Instantiate(copy_Loot).GetComponent <Copy>();
                    tempLoot.name = "Copy_Loot";
                    tempLoot.gameObject.SetActive(true);
                }
                //SHIELD
                if (randomItem == 2)
                {
                    Shield tempLoot = Instantiate(shield_Loot).GetComponent <Shield>();
                    tempLoot.name = "Shield_Loot";
                    tempLoot.gameObject.SetActive(true);
                }
                //LIFE
                if (randomItem == 1)
                {
                    int chance50 = Random.Range(0, 10);
                    if (chance50 >= 5)
                    {
                        Life tempLoot = Instantiate(life_Loot).GetComponent <Life>();
                        tempLoot.name = "Life_Loot";
                        tempLoot.gameObject.SetActive(true);
                    }
                }
            }

            Invoke("LetPlayerMakeNextTurn", 0.75f);
        }
    }
コード例 #30
0
 public static void AddLightning(Lightning newLightning)
 {
     lightningList.Add(newLightning);
 }
コード例 #31
0
ファイル: ColorBomb.cs プロジェクト: mengtest/BerryMatchThree
    IEnumerator ColorMixRoutine(Chip secondary)
    {
        chip.busy        = true;
        chip.gravity     = false;
        chip.destroyable = false;

        SimpleChip[]        allChips = FindObjectsOfType <SimpleChip>();
        List <SimpleChip>[] sorted   = new List <SimpleChip> [Chip.colors.Length];
        int[] count = new int[Chip.colors.Length];

        foreach (SimpleChip c in allChips)
        {
            if (c.chip.destroying)
            {
                continue;
            }
            if (!c.chip.slot)
            {
                continue;
            }
            if (c.chip == secondary)
            {
                continue;
            }
            count[c.chip.id]++;
            if (sorted[c.chip.id] == null)
            {
                sorted[c.chip.id] = new List <SimpleChip>();
            }
            sorted[c.chip.id].Add(c);
        }

        List <Slot> targets = new List <Slot>();

        int i;

        for (i = 0; i < Chip.colors.Length; i++)
        {
            if (sorted[i] != null && sorted[i].Count > 0)
            {
                targets.Add(sorted[i].GetRandom().chip.slot);
            }
        }

        yield return(new WaitForSeconds(0.1f));

        AudioAssistant.Shot("ColorBombCrush");
        chip.Play("Destroying");

        foreach (Slot target in targets)
        {
            Chip pu = FieldAssistant.main.AddPowerup(target.coord, secondary.chipType);
            target.chip = pu;
            Lightning.CreateLightning(3, transform, pu.transform, Chip.colors[chip.id]);
            yield return(new WaitForSeconds(0.1f));
        }

        yield return(new WaitForSeconds(0.2f));

        if (chip.slot.jam)
        {
            chip.jamType = chip.slot.jam.type;
        }
        SessionAssistant.main.EventCounter();
        if (secondary.chipType != "UltraColorBomb")
        {
            for (i = 0; i < targets.Count; i++)
            {
                if (targets[i].chip)
                {
                    targets[i].chip.jamType = chip.jamType;
                    targets[i].chip.DestroyChip();
                }
                yield return(new WaitForSeconds(0.05f));
            }
        }

        chip.busy    = false;
        chip.gravity = true;

        FieldAssistant.main.JellyCrush(chip.slot.coord);

        while (chip.IsPlaying("Destroying"))
        {
            yield return(0);
        }

        chip.ParentRemove();
        chip.HideChip(false);
    }
コード例 #32
0
 private void Start()
 {
     pos       = transform.GetChild(0).gameObject;
     lightning = transform.parent.GetComponent <Lightning>();
     index     = int.Parse(name.TrimStart('R', 'o', 't', 'a', 't', 'o', 'r'));
 }
コード例 #33
0
        public void StrikeLightning(Vector3 position)
        {
            Lightning lightning = new Lightning(this);

            lightning.SpawnEntity();
        }
コード例 #34
0
    IEnumerator TeleportChipRoutine(Chip chip, Slot target)
    {
        if (!chip.parentSlot)
        {
            yield break;
        }

        TrailRenderer trail     = chip.gameObject.GetComponentInChildren <TrailRenderer> ();
        float         trailTime = 0;

        if (trail)
        {
            trailTime  = trail.time;
            trail.time = 0;
        }

        float defScale = chip.transform.localScale.x;
        float scale    = defScale;

//		chip.animation.Play("Minimizing");
//
//		while (chip.animation.isPlaying) {
//			yield return 0;
//		}

        while (scale > 0f)
        {
            scale -= Time.deltaTime * 10f;
            chip.transform.localScale = Vector3.one * scale;
            yield return(0);
        }


        if (!target.GetChip() && chip && chip.parentSlot)
        {
            Transform a = chip.parentSlot.transform;
            Transform b = target.transform;

            Color color;
            if (chip.id == Mathf.Clamp(chip.id, 0, 5))
            {
                color = Chip.colors[chip.id];
            }
            else
            {
                color = Color.white;
            }

            Lightning l = Lightning.CreateLightning(5, a, b, color);

            target.SetChip(chip);

            chip.transform.position = chip.parentSlot.transform.position;
            yield return(0);

            l.end = null;
        }

        yield return(0);


        if (trail)
        {
            trail.time = trailTime;
        }

        scale = 0.2f;
        while (scale < defScale)
        {
            scale += Time.deltaTime * 10f;
            chip.transform.localScale = Vector3.one * scale;
            yield return(0);
        }

        chip.transform.localScale = Vector3.one * defScale;
    }