示例#1
0
 void OnShellAttacked(ShellAttackedSendMsgParam param)
 {
     if (param.attackedShellKind != ShellKind.Bullet)
     {
         attackedFlag = true;
     }
 }
示例#2
0
 void OnShellAttacked(ShellAttackedSendMsgParam param)
 {
     spawnseg.GetComponent <SpawnTreesegmentsBehaviour>().detail          *= 2;
     spawnseg.GetComponent <SpawnTreesegmentsBehaviour>().explodeShellflag = true;
     spawnseg.transform.parent  = null;
     this.rigidbody.isKinematic = false;
     Destroy(this.gameObject);
 }
示例#3
0
    //When Shell Attacked
    void OnShellAttacked(ShellAttackedSendMsgParam param)
    {
        return;

        FindPointInTriangle(param.attackedPoint);
        CalculateUVPos(param.attackedPoint);
        StartCoroutine("AddTextureToMap");
    }
示例#4
0
 void OnShellAttacked(ShellAttackedSendMsgParam param)
 {
     if (!splitted)
     {
         return;
     }
     StartCoroutine("AttackedBehaviour", param);
 }
    void OnShellAttacked(ShellAttackedSendMsgParam param)
    {
        Vector3            tmp = param.attackedPoint - param.direction;
        HouseActivityParam p   = new HouseActivityParam();

        p.origin = tmp;
        OnHit(p);
    }
 void OnShellAttacked(ShellAttackedSendMsgParam param)
 {
     if (emitter)
     {
         return;
     }
     destructedAmount = GlobalInfo.shellProperty[(int)param.attackedShellKind].destructionPower;
     StartCoroutine("AttackedBehaviour", param);
 }
    void OnShellAttacked(ShellAttackedSendMsgParam param)
    {
        float explosionPower = GlobalInfo.shellProperty[(int)param.attackedShellKind].explosionPower;

        rigidbody.AddExplosionForce(drumexppower, param.attackedPoint, 3.0f, 10f, ForceMode.Impulse);
        Inner.emit = true;
        Smoke.emit = true;
        Destroy(this.gameObject, 5f);
    }
示例#8
0
 void OnShellAttacked(ShellAttackedSendMsgParam param)
 {
     if (oilExplosion == null)
     {
         return;
     }
     if (param.attackedShellKind != ShellKind.Bullet)
     {
         GameObject.Instantiate(oilExplosion, param.attackedPoint, Quaternion.identity);
     }
 }
示例#9
0
 void OnShellAttacked(ShellAttackedSendMsgParam param)
 {
     if (networkView.viewID.Equals(param.viewID))
     {
         return;
     }
     StartCoroutine("AttackedBehaviour", param);
     if (networkView.isMine)
     {
         GlobalInfo.rpcControl.RPC("OnUpdateUserHitCountRPC", RPCMode.Server, param.userName);
     }
 }
示例#10
0
 void OnShellAttacked(ShellAttackedSendMsgParam param)
 {
     if (networkView.viewID.Equals(param.viewID))
     {
         return;
     }
     destructedAmount = GlobalInfo.shellProperty[(int)param.attackedShellKind].destructionPower;
     StartCoroutine("AttackedBehaviour", param);
     if (networkView.isMine)
     {
         GlobalInfo.rpcControl.RPC("OnUpdateUserHitCountRPC", RPCMode.Server, param.userName);
     }
 }
    IEnumerator RaiseWaterFoam(ShellAttackedSendMsgParam param)
    {
        yield return(new WaitForSeconds(0.3f));

        if (param.attackedShellKind.Equals(ShellKind.LightShell))
        {
            Instantiate(explosion[7], param.attackedPoint, Quaternion.identity);
        }
        else
        {
            Instantiate(explosion[8], param.attackedPoint, Quaternion.identity);
        }
    }
示例#12
0
    IEnumerator AttackedBehaviour(ShellAttackedSendMsgParam param)
    {
        yield return(new WaitForSeconds(0.0f));

        destructedAmount += GlobalInfo.shellProperty[(int)param.attackedShellKind].destructionPower;
        GameObject.Instantiate(explosion, param.attackedPoint, Quaternion.identity);
        if (destructedAmount >= defensivePower)
        {
            destructedAmount = 0.0f;
            Vector3            hitpoint = transform.InverseTransformPoint(param.attackedPoint);
            HouseActivityParam p        = new HouseActivityParam();
            p.hitpoint = hitpoint;
            p.radius   = shotradius;
            StartCoroutine("houseactivity", p);
        }
    }
    void OnShellAttackedRPC(Vector3 attackedPos, Vector3 normal, Vector3 dir, int shellKind, NetworkViewID viewID, string userName)
    {
        if (!enabledFlag)
        {
            return;
        }
        ShellAttackedSendMsgParam param = new ShellAttackedSendMsgParam();

        param.attackedPoint     = attackedPos;
        param.attackedShellKind = (ShellKind)shellKind;
        param.normal            = normal;
        param.direction         = dir;
        param.viewID            = viewID;
        param.userName          = userName;
        GlobalInfo.eventHandler.SendMessage("OnShellAttacked", param, SendMessageOptions.DontRequireReceiver);
    }
    // Use this for initialization
    void OnShellAttacked(ShellAttackedSendMsgParam param)
    {
        RaycastHit hit = new RaycastHit();
        Vector3    tmp;

        Physics.Raycast(new Ray(param.attackedPoint + new Vector3(0, 3.0f, 0), Vector3.down), out hit);
        if (hit.collider != null)
        {
            if (hit.collider.gameObject.Equals(this.gameObject))
            {
                GameObject.Instantiate(explosion, param.attackedPoint, Quaternion.identity);

//				tmp = param.attackedPoint - hit.point;
//				if(tmp.magnitude <= EP)
//					StartCoroutine("AttackedBehaviour",param);
            }
        }
    }
    void OnAttackVibrate(ShellAttackedSendMsgParam param)
    {
        if (!networkView.isMine)
        {
            return;
        }
        if (param.attackedShellKind == ShellKind.Bullet)
        {
            return;
        }
        Vector3 tmp = param.attackedPoint - transform.position;

        if (tmp.magnitude < GlobalInfo.shellProperty[(int)param.attackedShellKind].explosionRadius)
        {
            if (GlobalInfo.specialCamState)
            {
                camPos = cam.localPosition;
            }
            else
            {
                switch (GlobalInfo.camPosState)
                {
                case 0:
                    break;

                case 1:
                    camPos = secondaryCamPos.position;
                    break;

                case 2:
                    camPos = thirdCamPos.position;
                    break;

                default:
                    break;
                }
            }
            vibrateForce           = camVibrateForce;
            GlobalInfo.camAnimFlag = true;
            camAnimTime            = 0.0f;
//			Camera.mainCamera.GetComponent<MotionBlur>().enabled = true;
            Camera.mainCamera.GetComponent <MotionBlur>().blurAmount = 1.0f;
        }
    }
示例#16
0
    IEnumerator AttackedBehaviour(ShellAttackedSendMsgParam param)
    {
        yield return(new WaitForSeconds(0));

        if (networkView.isMine)
        {
            camPos.GetComponent <MotionBlur>().enabled = true;
            blurFlag = true;
            blurTime = 0.0f;
        }
        foreach (Transform a in shellAttackedFlame)
        {
            a.particleEmitter.emit    = true;
            a.particleEmitter.minSize = 3.0f;
            a.particleEmitter.maxSize = 9.0f;
        }
        destructionState += GlobalInfo.shellProperty[(int)param.attackedShellKind].destructionPower;
        if (networkView.isMine)
        {
            if (destructionState >= defensivePower)
            {
                if (Network.isServer)
                {
                    for (int i = 0; i < GlobalInfo.userInfoList.Count; i++)
                    {
                        if (GlobalInfo.userInfoList[i].name.Equals(param.userName))
                        {
                            GlobalInfo.userInfoList[i].score += defensivePower;
                            break;
                        }
                    }
                    GlobalInfo.eventHandler.SendMessage("OnUpdateUserScore", SendMessageOptions.DontRequireReceiver);
                }
                else
                {
                    GlobalInfo.rpcControl.RPC("OnUpdateUserScoreRPC", RPCMode.Server, param.userName, defensivePower);
                }
//				string chatString = GlobalInfo.userInfo.name + defeatLabel1 + param.userName + defeatLabel2;
//				GlobalInfo.rpcControl.RPC("OnChatMessageRPC",RPCMode.All,chatString);
                destroyedFlag = true;
            }
        }
    }
    IEnumerator AttackedBehaviour(ShellAttackedSendMsgParam param)
    {
        yield return(new WaitForSeconds(0));

        destructionState += destructedAmount;
        if (destructionState >= defensivePower)
        {
            falldowned = true;
            psangle    = 0;
            if (thinTreeFlag)
            {
                collider.enabled = false;
            }
            Vector3 contactpoint = param.attackedPoint;
            Vector3 vectora      = contactpoint - myPos.position;
            rotationaxis = Vector3.up;
            resultvector = Vector3.Cross(rotationaxis, -vectora);
            emitter      = true;
        }
    }
    void OnShellAttacked(ShellAttackedSendMsgParam param)
    {
        RaycastHit[] hits;
        Transform    tr;
        Vector3      sweepSpartPoint;
        bool         flag = false;

        System.Collections.Generic.List <GameObject> hitList = new System.Collections.Generic.List <GameObject>();

        sweepSpartPoint = param.attackedPoint - param.direction;
        hits            = Physics.SphereCastAll(new Ray(sweepSpartPoint, param.direction), 0.5f, param.direction.magnitude * 2.0f);
        if (hits.Length > 0)
        {
            foreach (RaycastHit h in hits)
            {
                if (h.collider != null)
                {
                    tr = h.collider.transform;
                    while (tr.parent != null)
                    {
                        flag = false;
                        foreach (GameObject go in hitList)
                        {
                            if (go.Equals(tr.gameObject))
                            {
                                flag = true;
                                break;
                            }
                        }
                        if (!flag)
                        {
                            hitList.Add(tr.gameObject);
                        }
                        tr = tr.parent;
                    }
                    flag = false;
                    foreach (GameObject go in hitList)
                    {
                        if (go.Equals(tr.gameObject))
                        {
                            flag = true;
                            break;
                        }
                    }
                    if (!flag)
                    {
                        hitList.Add(tr.gameObject);
                    }
                }
            }
            foreach (GameObject go in hitList)
            {
                go.SendMessage("OnShellAttacked", param, SendMessageOptions.DontRequireReceiver);
            }
        }
        if (GlobalInfo.canon != null)
        {
            GlobalInfo.canon.SendMessage("OnAttackVibrate", param, SendMessageOptions.DontRequireReceiver);
        }
        Instantiate(explosion[(int)param.attackedShellKind], param.attackedPoint, Quaternion.identity);
        if (param.attackedPoint.y < GlobalInfo.water_Level)
        {
            StartCoroutine("RaiseWaterFoam", param);
        }
    }
示例#19
0
    IEnumerator AttackedBehaviour(ShellAttackedSendMsgParam param)
    {
        yield return(new WaitForSeconds(0));

        destructionState += destructedAmount;
        foreach (Transform a in shellAttackedFlame)
        {
            a.particleEmitter.minSize = 4.0f;
            a.particleEmitter.maxSize = 9.0f;
        }
        GameObject.Instantiate(oilExplosion, param.attackedPoint, Quaternion.identity);
        mat.SetFloat("_CurBrokenCount", destructionState * 3.0f);
        foreach (Transform a in breakables)
        {
            if (a.renderer.materials.Length > 1)
            {
                a.renderer.materials[0] = mat;
            }
            else
            {
                a.renderer.material = mat;
            }
        }
        if (networkView.isMine)
        {
            if (tankControlState == TankControlState.Manual)
            {
                Camera.mainCamera.GetComponent <MotionBlur>().enabled = true;
            }

            blurFlag = true;
            blurTime = 0.0f;
            if (destructionState > defensivePower)
            {
                if (Network.isServer)
                {
                    for (int i = 0; i < GlobalInfo.userInfoList.Count; i++)
                    {
                        if (GlobalInfo.userInfoList[i].name.Equals(param.userName))
                        {
                            GlobalInfo.userInfoList[i].score += defensivePower;
                            break;
                        }
                    }
                    GlobalInfo.eventHandler.SendMessage("OnUpdateUserScore", SendMessageOptions.DontRequireReceiver);
                }
                else
                {
                    GlobalInfo.rpcControl.RPC("OnUpdateUserScoreRPC", RPCMode.Server, param.userName, defensivePower);
                }
//				string chatString = GlobalInfo.userInfo.name + defeatLabel1 + param.userName + defeatLabel2;
//				GlobalInfo.rpcControl.RPC("OnChatMessageRPC",RPCMode.All,chatString);
                if (tankControlState == TankControlState.Manual)
                {
                    FinalOperation();
                    GlobalInfo.rpcControl.networkView.RPC("OnDestroyedRPC", RPCMode.All, (int)equipKind, transform.position, transform.rotation, GlobalInfo.playerViewID, GlobalInfo.userInfo.name);
                }
                else
                {
                    string nam = "";
                    foreach (UserInfoClass uf in GlobalInfo.userInfoList)
                    {
                        if (uf.playerViewID.Equals(networkView.viewID))
                        {
                            nam = uf.name;
                        }
                    }
                    GlobalInfo.rpcControl.networkView.RPC("OnDestroyedRPC", RPCMode.All, (int)equipKind, transform.position, transform.rotation, networkView.viewID, nam);
                }
                Network.RemoveRPCs(networkView.viewID);
                Network.Destroy(gameObject);
            }
        }
    }
示例#20
0
 void OnShellAttacked(ShellAttackedSendMsgParam param)
 {
     GameObject.Instantiate(oilExplosion, param.attackedPoint, Quaternion.identity);
     DestroyImmediate(gameObject);
 }