// Use this for initialization
    void Awake()
    {
        if (Instance != null) {
            Debug.Log ("More than one painter has been instantiated in the scene");
        }
        Instance = this;

        if(PaintSprite == null)
        {
            Debug.Log("Missing paintSprite Prefab");
        }
        int count = 0;
        SetCountText ();
    }
Beispiel #2
0
        private PaintSplatter createPaintSplatter(int npcOwner, Vector2 position, Vector2 velocity, int timeLeft = 30, float light = 0, float scale = 1f)
        {
            Projectile p = Projectile.NewProjectileDirect(position, velocity, ProjectileType <PaintSplatter>(), 0, 0);

            if (p != null)
            {
                p.scale    = scale;
                p.velocity = velocity;
                p.timeLeft = timeLeft;
                p.light    = light;
                PaintSplatter proj = p.modProjectile as PaintSplatter;
                if (proj != null)
                {
                    proj.npcOwner = npcOwner;
                    return(proj);
                }
            }
            return(null);
        }
    // Use this for initialization
    void Start()
    {
        sound =  GetComponent<AudioSource>();
        cam = Camera.main.GetComponent<OverheadCameraController>();
        rend = GetComponent<Renderer>();
        anim = GetComponent <Animator>();
        equipmentCollider = equipment.GetComponent<CapsuleCollider>();
        input = GetComponent<TennisInputHandler>();
        input.control = this;
        rb = GetComponent<Rigidbody>();
        rend.material.color = c1;
        alive = true;
        anim.SetBool("Alive", true);
        impactMod = 7.5f;
        respawnPoints = GameObject.FindGameObjectsWithTag("RespawnPoint");
        equipmentCollider.enabled = false;
        if (respawnPoints.Length == 0)
        {
            Debug.Log("There aren't any respawn points, you catastrophic dingus.");
        }

        respawnPointsTeamA = GameObject.FindGameObjectsWithTag ("RespawnPointTeamA");
        respawnPointsTeamB = GameObject.FindGameObjectsWithTag ("RespawnPointTeamB");

        paint = GetComponent<PaintSplatter>();
        //		paint.color = c1;
        hitForce = 25;
    }
Beispiel #4
0
 //This is used for controlling certain Chaos Mode functionality
 public override void NPCLoot(NPC npc)
 {
     base.NPCLoot(npc);
     if (chaosMode())
     {
         if (painted)
         {
             switch (npc.type)
             {
             case NPCID.EyeofCthulhu:
             case NPCID.Spazmatism:
             case NPCID.Retinazer:
             case NPCID.Skeleton:
             case NPCID.SkeletronHand:
             case NPCID.SkeletronPrime:
             case NPCID.PrimeCannon:
             case NPCID.PrimeLaser:
             case NPCID.PrimeSaw:
             case NPCID.PrimeVice:
             case NPCID.BrainofCthulhu:
             case NPCID.KingSlime:
             case NPCID.Everscream:
             case NPCID.SantaNK1:
             case NPCID.IceQueen:
             case NPCID.Plantera:
             case NPCID.MourningWood:
             case NPCID.WallofFlesh:
             case NPCID.WallofFleshEye:
             case NPCID.DukeFishron:
             case NPCID.MoonLordCore:
             case NPCID.QueenBee:
             case NPCID.DD2OgreT2:
             case NPCID.DD2OgreT3:
             case NPCID.DD2Betsy:
             case NPCID.DD2DarkMageT1:
             case NPCID.DD2DarkMageT3:
                 if (true)
                 {
                     Vector2 dir = new Vector2(1, 0);
                     List <PaintingProjectile> projectiles = new List <PaintingProjectile>();
                     for (int i = 0; i < 8; i++)
                     {
                         Vector2       rotatedDir = dir.RotatedBy((PI / 4f) * i);
                         PaintSplatter p          = createPaintSplatter(npc.whoAmI, npc.Center + rotatedDir * 48, rotatedDir * 10, 100, .5f, 2f);
                         if (p != null)
                         {
                             projectiles.Add(p);
                         }
                         rotatedDir = rotatedDir.RotatedBy(PI / 8f);
                         PaintSplatter p2 = createPaintSplatter(npc.whoAmI, npc.Center + rotatedDir * 32, rotatedDir * 6, 100);
                         if (p2 != null)
                         {
                             projectiles.Add(p2);
                         }
                     }
                     if (singlePlayer())
                     {
                         for (int i = 0; i < 20; i++)
                         {
                             Dust d = Dust.NewDustDirect(npc.Center - npc.Size / 4f, npc.width / 2, npc.height / 2, DustType <PaintDust>(), 0, 0, 0, getColor(_paintData), 2);
                             if (d != null)
                             {
                                 d.velocity = (d.position - npc.Center).SafeNormalize(new Vector2(1, 0)) * 5;
                                 if (d.customData != null)
                                 {
                                     ((float[])d.customData)[0] = 0;
                                 }
                             }
                         }
                     }
                     if (server())
                     {
                         PaintingProjectile.sendMultiProjNPCOwnerPacket(projectiles);
                     }
                 }
                 break;
             }
         }
         if (npc.townNPC)
         {
             if (npc.type == NPCID.PartyGirl)
             {
                 splatterColored(npc.Center, 8, new byte[] { PaintID.DeepRed, PaintID.DeepRed, PaintID.DeepOrange, PaintID.DeepYellow, PaintID.DeepGreen, PaintID.DeepBlue, PaintID.DeepPurple }, new PaintData(1, PaintMethods.BlocksAndWalls), true);
                 for (int i = 0; i < 10; i++)
                 {
                     Vector2 vel = new Vector2(Main.rand.NextFloat(2, 3), 0).RotatedBy(Main.rand.NextFloat(PI * 2));
                     Dust.NewDust(npc.Center - npc.Size / 4f, npc.width / 2, npc.height / 2, DustID.Confetti + Main.rand.Next(0, 4), vel.X, vel.Y, 0);
                 }
             }
             else
             {
                 PaintData data = new PaintData(PaintID.DeepRed);
                 splatter(npc.Center, 100f, 8, data, true);
             }
         }
     }
 }
    // Use this for initialization
    void Start()
    {
        sound =  GetComponent<AudioSource>();
        cam = Camera.main.GetComponent<TennisCameraController>();
        rend = GetComponent<Renderer>();
        anim = GetComponent <Animator>();
        equipmentCollider = equipment.GetComponent<CapsuleCollider>();
        equipmentCollider.enabled = false;
        input = GetComponent<TennisInputHandlerGans>();
        input.control = this;
        rb = GetComponent<Rigidbody>();
        rend.material.color = color;
        alive = true;
        anim.SetBool("Alive", true);
        impactMod = 7.5f;

        paint = GetComponent<PaintSplatter>();
        paint.c = color;
        hitForce = 25;
        //		stats.ResetStats ();
        SetOriginSide ();
        InitializeStatCard();
        respawnTime = 3;
        timeOfDeath = Mathf.Infinity;
        ActiveDevice = device != null;
    }