示例#1
0
        public void ReceivePortal(Portal portal, Portal other, int clipIndex, ShootState state, Vector3 impact, Vector3 pos, Vector3 normal)
        {
            MuzzlePlarticle(portal);
            switch (state)
            {
            case ShootState.Place:
                ImpactParticle(impact, normal, portal, portal.layer);
                portal.Place(this, pos, Quaternion.LookRotation(normal, GetPseudoPortalUp(portal.transform, normal)), Vector3.one * size.Value);

                SetEmission(portal.color);
                VidyaMod.PlayAudio(audioSource, clips[clipIndex], 1f, 0.9f, 1.05f);
                break;

            case ShootState.Impact:
                ImpactParticle(impact, normal, portal, other.layer);
                other.StartAnimation(PortalAnim.Disturb);
                VidyaMod.PlayAudio(audioSource, clips[2], 0.9f);
                break;

            case ShootState.Miss:
                VidyaMod.PlayAudio(audioSource, clips[2], 0.9f);
                break;

            case ShootState.Unable:
                VidyaMod.PlayAudio(audioSource, clips[2], 0.3f);
                portal.StartAnimation(PortalAnim.Disturb);
                other.StartAnimation(PortalAnim.Disturb);
                break;
            }
        }
示例#2
0
        public void ShootPortal(Portal portal, Portal other, AudioClip clip)
        {
            RaycastHit target = RaycastPortal(portal.transform, other.transform);
            Vector3    org    = target.point;

            target = CheckPortal(target, portal, other);

            if (target.distance >= 0f)
            {
                if (target.distance > 0f)
                {
                    ImpactParticle(org, target.normal, portal, portal.layer);
                    portal.Place(this, target.point, Quaternion.LookRotation(target.normal, GetPseudoPortalUp(portal.transform, target.normal)), Vector3.one * size.Value);

                    SetEmission(portal.color);
                    SendPortalPlacement(portal, ShootState.Place, org, target.point, target.normal);
                    return;
                }
                else
                {
                    ImpactParticle(org, target.normal, portal, other.layer);
                    other.StartAnimation(PortalAnim.Disturb);
                    SendPortalPlacement(portal, ShootState.Impact, org, target.point, target.normal);
                    return;
                }
            }
            SendPortalPlacement(portal, ShootState.Miss, org, target.point, target.normal);
            VidyaMod.PlayAudio(audioSource, clips[2], 0.9f);
        }
示例#3
0
 protected void SendPortalPlacement(Portal portal, ShootState state, Vector3 impact, Vector3 pos, Vector3 normal)
 {
     MuzzlePlarticle(portal);
     VidyaMod.PlayAudio(audioSource, state == ShootState.Place ? clips[portal.index] : clips[2], 0.9f);
     if (!StatMaster.isLocalSim)
     {
         Message targetMessage = portalShotMessageType.CreateMessage(Block.From(this), portal.index, (int)state, impact, pos, normal);
         ModNetworking.SendToAll(targetMessage);
     }
 }
示例#4
0
        public GameObject ReplaceWithChicken(MonoBehaviour m)
        {
            if (m.name.Contains("Chicken"))
            {
                return(m.gameObject);
            }
            GameObject g = m.gameObject;

            m.gameObject.name = "Polymorphed Chicken";
            //Debug.Log(Chicken + ", " + m);
            GameObject featherBurst = Instantiate(Chicken.dustCorpse, m.transform.position, Quaternion.identity, m.transform.parent) as GameObject;

            VidyaMod.PlayAudio(audioSource, clip, 1f, 0.95f, 1.1f);

            if (m is EntityAI)
            {
                EntityAI ai = m as EntityAI;

                SetVisual(ai);
                ChangePosing(ai);
                ChangeDeathController(ai);
                ChangeBobbing(ai);
                ChangeFaction(ai);
                ChangeBehaviour(ai);
                ChangeSounds(ai);

                if (StatMaster.isHosting || StatMaster.isLocalSim)
                {
                    ChangeFireControl(ai);

                    ToChickenColliderAnimator collideranim = ai.gameObject.AddComponent <ToChickenColliderAnimator>();
                    collideranim.Setup(ai, Chicken.AI.my.Collider as SphereCollider);
                }
            }
            else if (m is SimpleBirdAI)
            {
                g = Spawn(Chicken.prefab, m.gameObject);
                Destroy(m.gameObject);
            }
            else
            {
                g = Spawn(Chicken.prefab, m as EnemyAISimple);
                Destroy(m.gameObject);
            }
            return(g);
        }